I am trying to trigger the installation of updates advertized by SCCM to some particular computers by invoking a CIM method from Powershell 7. Regardless of the fact that the command triggers the desired action, I still always get an error message.
Invoke-CimMethod: Es wurde keine Instanz mit den Eigenschaftswerten gefunden.
or translated to English:
Invoke-CimMethod : No instance found with given property values.
This is the code:
$COMPUTERNAME = 'RemoteComputer01' $CIMSession = New-CimSession -ComputerName $COMPUTERNAME $GetCimInstanceParams = @{ NameSpace = 'ROOT\ccm\ClientSDK' ClassName = 'CCM_SoftwareUpdate' Filter = 'ComplianceState = 0' CimSession = $CIMSession ErrorAction = 'Stop' } $InvokeCimMethodParams = @{ Namespace = 'ROOT\ccm\ClientSDK' ClassName = 'CCM_SoftwareUpdatesManager' MethodName = 'InstallUpdates' Arguments = @{ CCMUpdates = [ciminstance[]](Get-CimInstance @GetCimInstanceParams) } CimSession = $CIMSession ErrorAction = 'Stop' } Invoke-CimMethod @InvokeCimMethodParams
<p class=“”>And it does not matter how I try to invoke the CIM method - splatted or in a single line - I always get the error.</p>
Invoke-CimMethod -Namespace 'root/ccm/ClientSDK' -ClassName 'CCM_SoftwareUpdatesManager' -ComputerName $ComputerName -Arguments @{ CCMUpdates = [ciminstance[]] (Get-CimInstance -Namespace 'root/ccm/ClientSDK' -ClassName 'CCM_SoftwareUpdate' -ComputerName $ComputerName) } -MethodName 'InstallUpdates'
What’s wrong? How do I get rid of the error and get a proper return value?</p>
I already asked this question on StackOverflow but I didn’t get any response yet.
The formatting here still messes up with code. Please take a look at StackOverflow for the correct code.
Thanks in advance.