So, trying to trigger a software update in SCCM with Invoke-CimMethod instead of Invoke-WMIMethod.
WMIMethod Works:
$UpdateID = 'Site_1EED8E47-D4D8-4823-883C-4FFE753FA233/SUM_0af47e05-17cb-4756-8610-09ce486df1ba'
$FeatureUpdate = Get-WmiObject -Namespace Root\CCM\ClientSDK -Class CCM_SoftwareUpdate -Filter "UpdateID like '$UpdateID'"
Invoke-WmiMethod -Namespace Root\ccm\clientSDK -Class CCM_SoftwareUpdatesManager -Name InstallUpdates -ArgumentList $FeatureUpdate
Note that $FeatureUpdate is a instance of an update:
$FeatureUpdate.GetType()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True ManagementObject System.Management.ManagementBaseObject
Now with Invoke-CimMethod:
$Instance=Get-CimInstance -Namespace Root\CCM\ClientSDK -Class CCM_SoftwareUpdate -Filter "UpdateID like '$UpdateID'"
Invoke-CimMethod -Namespace Root\ccm\clientSDK -Class CCM_SoftwareUpdatesManager -MethodeName InstallUpdates -Arguments @{CCMUpdates = $Instance}
Invoke-CimMethod : Type mismatch for parameter "CCMUpdates"
At line:1 char:1
+ Invoke-CimMethod -ClassName CCM_SoftwareUpdatesManager -Namespace Roo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidType: (Root\CCM\Client...eUpdatesManager:String) [Invoke-CimMethod], CimException
+ FullyQualifiedErrorId : HRESULT 0x80041005,Microsoft.Management.Infrastructure.CimCmdlets.InvokeCimMethodCommand
Note the Instance:
$instance.GetType()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True CimInstance System.Object
Am I missing something on triggering the install with the arguments? Not sure if this helps..
(((Get-CimClass -Namespace ROOT\ccm\ClientSDK -Class CCM_SoftwareUpdatesManager).CimClassMethods)|where {$_.name
-like 'InstallUpdates'}).parameters
Name CimType Qualifiers ReferenceClassName
---- ------- ---------- ------------------
CCMUpdates InstanceArray {EmbeddedInstance, ID, in}
(((Get-CimClass -Namespace ROOT\ccm\ClientSDK -Class CCM_SoftwareUpdatesManager).CimClassMethods)|where {$_.name
-like 'InstallUpdates'}).parameters.Qualifiers
Name Value CimType Flags
---- ----- ------- -----
EmbeddedInstance CCM_SoftwareUpdate String EnableOverride, ToSubclass
ID 0 SInt32 DisableOverride, ToSubclass
in True Boolean DisableOverride, ToSubclass
Figured it out after letting it sit for the day. Found some posts to lead me in the right direction.
Final final:
$UpdateID = 'Site_1EED8E47-D4D8-4823-883C-4FFE753FA233/SUM_0af47e05-17cb-4756-8610-09ce486df1ba'
$Instance = @(Get-CimInstance -Namespace ROOT\ccm\ClientSDK -ClassName CCM_SoftwareUpdate -Filter "UpdateID like '$UpdateID'")
Invoke-CimMethod -Namespace ROOT\ccm\ClientSDK -ClassName CCM_SoftwareUpdatesManager -MethodName InstallUpdates -Arguments @{CCMUpdates = [ciminstance[]]$Instance}
Returns, and updates install:
ReturnValue PSComputerName
----------- --------------
0
User contributions licensed under CC BY-SA 3.0