Hello! I am using the cWebsite DSC resource to create an IIS website. I have modified the resource, as I need to be able to add net.pipe as a binding to a few of my sites. The set-targetresource portion of the program works great and my sites are created the way I expect with no errors encountered.
While using the get-dscconfiguration command however, I am experiencing an error. For some context, this error is being generated while attempting to return the website bindings. The error message is as follows:
Get-DscConfiguration : Could not infer CimType from the provided .NET object. At line:1 char:1 + Get-DscConfiguration + ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (Microsoft.Manag...InstanceCommand:root/Microsoft/...gurationManager) [Get-DscConfiguration], CimException + FullyQualifiedErrorId : New-CimInstance,Microsoft.Management.Infrastructure.CimCmdlets.NewCimInstanceCommand,Get -DscConfiguration
I have tracked down the offending line of code, as if I remove it I no longer encounter the error:
New-CimInstance -ClassName PSHOrg_cWebBindingInformation -Namespace root/microsoft/Windows/DesiredStateConfiguration -Property @{Port=[System.UInt16]$BindingObject.Port;Protocol=$BindingObject.Protocol;IPAddress=$BindingObject.IPaddress;HostName=$BindingObject.Hostname;CertificateThumbprint=$BindingObject.CertificateThumbprint;CertificateStoreName=$BindingObject.CertificateStoreName} -ClientOnly
If I attempt to run the above command directly on the machine who is receiving the DSC configuration (from a pull server) I get this slightly different flavor of the error message:
New-CimInstance : Could not infer CimType from the provided .NET object. At line:1 char:1 + New-CimInstance -ClassName PSHOrg_cWebBindingInformation -Namespace r ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (Microsoft.Manag...InstanceCommand:NewCimInstanceCommand) [New-CimInst ance], ArgumentException + FullyQualifiedErrorId : New-CimInstance,Microsoft.Management.Infrastructure.CimCmdlets.NewCimInstanceCommand
I am somewhat new to using PowerShell in an advanced fashion and am not really sure what this error message is trying to tell me, nor am I really familiar with what the New-CimInstance command is actually doing Googling has yielded no helpful results thus far. I am sort of just hitting it with a hammer at this point to see if I can break it in a different way to give me a better clue or magically stumble upon a fix.
Anyway, if anyone knows anything about this error or can educate me on the New-CimInstance command, that would be awesome If anyone has questions or needs more info, I’ll be happy to share.
Thanks!