我按照 Microsoft 的 Scripting Guy 说明进行操作,但即便如此,我仍然收到相同的错误Scripting Guy article
这是我的脚本:
$p2=Get-CimInstance -N root\cimv2\power -Class win32_PowerPlan -Filter "ElementName = 'Balanced'"
Invoke-CimMethod -InputObject $p2-MethodName Activate
这导致:
Invoke-CimMethod : This method is not implemented in any class
At line:1 char:1
+ Invoke-CimMethod -InputObject $p2 -MethodName Activate
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : MetadataError: (Win32_PowerPlan...2-f694-41f0...):CimInstance) [Invoke-CimMethod], CimException
+ FullyQualifiedErrorId : HRESULT 0x80041055,Microsoft.Management.Infrastructure.CimCmdlets.InvokeCimMethodCommand
我似乎找不到我在几个地方看过的答案,几个月前我看到人们开始遇到这个问题,但我找不到答案,任何建议都将不胜感激
我的最终目标是编写一个脚本,在其中导入电源计划,然后激活它我的导入部分工作正常,就在最后一点。$p 包含我导入的计划,我在默认计划上使用了 $p2 以进行测试。
干杯,并提前感谢您提供的任何建议