I want to trigger software updates to install via SCCM 2012 which works fine with WMI but I can’t get the CIM equivalent to work. Hoping someone can help.
Cannot convert the "CCM_SoftwareUpdate (UpdateID = "Site_xxxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx...)" value of type "Microsoft.Management.Infrastructure.CimInstance#ROOT/ccm/ClientSDK/CCM_SoftwareUpdate" to
type "System.Management.ManagementObject".
At line:1 char:1
+ $a = Get-CimInstance -Query "SELECT * FROM CCM_SoftwareUpdate" -Names ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : MetadataError: (:) [], ArgumentTransformationMetadataException
+ FullyQualifiedErrorId : RuntimeException
Cannot convert the "ROOT\ccm\ClientSDK:CCM_SoftwareUpdatesManager" value of type "System.String" to type "Microsoft.Management.Infrastructure.CimClass".
At line:2 char:1
+ ([cimclass]'ROOT\ccm\ClientSDK:CCM_SoftwareUpdatesManager').InstallUp ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [], RuntimeException
+ FullyQualifiedErrorId : ConvertToFinalInvalidCastException
I don’t know if any of the below helps but figured I would post it since most people won’t have the SCCM 2012 client installed. I’m sort of out of my depth
This looks like it should point you in the right direction. It appears when you do the invoke you have to reference the namespace, etc. to find the method:
[wmiclass] is a type accelerator for System.management.Class (see page 88 of PowerShell and WMI) and should be used to create new instances of a PowerShell class
There isn’t a [cimclass] type accelerator
You need to invoke the method of the class when using the CIM cmdlets so something like
That particular class, if I’m seeing this correctly, is built using a kind of odd underlying provider. I think .NET is having trouble connecting to it properly. Keep in mind that CIM is basically native code, and this particular one doesn’t appear to be entirely complying with the interface standards. Which, given SCCM, perhaps is not shocking.