我似乎无法将下面的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有关,但是我尝试将其更改为的所有操作均产生了错误。

最佳答案

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

10-08 01:35