我似乎无法将下面的Invoke-WmiMethod命令重新配置为有效的Invoke-CimMethod命令。此代码用于运行SCCM客户端操作。想要运行“ ApplicationDeploymentEvaluation”操作的示例如下。
有效方法:
Invoke-WmiMethod -Namespace ROOT\ccm -Class SMS_CLIENT -Name TriggerSchedule '{00000000-0000-0000-0000-000000000121}'
我尝试将其重新配置为更易于阅读和复制的CimMethod,但这是行不通的。
Invoke-CimMethod -Namespace ROOT\ccm -Class SMS_CLIENT -Name TriggerSchedule '{00000000-0000-0000-0000-000000000121}'
收到错误:
Invoke-CimMethod : Cannot bind parameter 'Arguments'. Cannot convert the "{00000000-0000-0000-0000-000000000121}" value of type "System.String" to type "System.Collections.IDictionary".
At line:1 char:106
+ ... CLIENT -Name TriggerSchedule '{00000000-0000-0000-0000-000000000121}'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Invoke-CimMethod], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.Management.Infrastructure.CimCmdlets.InvokeCimMethodCommand
我相当确定问题与-Name
有关,但是我尝试将其更改为的所有操作均产生了错误。
答案 0 :(得分:2)
Arguments
是字典
[[-Arguments]词典]
Invoke-CimMethod -Namespace ROOT\ccm -Class SMS_CLIENT -Name TriggerSchedule -Arguments @{sScheduleID = '{00000000-0000-0000-0000-000000000121}'}
sScheduleID
来自
(Get-CimClass -Namespace ROOT\ccm -Class SMS_CLIENT).CimClassMethods