$computer = gc env:computername
$key = "WINDOWS CODE EDITED OUT"
$service = get-wmiObject -query "select * from SoftwareLicensingService" -computername $computer
$service.InstallProductKey($key)
$service.RefreshLicenseStatus()
Read-Host -Prompt "Press Enter to Continue"
我正在尝试通过PowerShell脚本启动Windows,但它不起作用。这是我得到的错误:
Exception calling "InstallProductKey" : "" At line:4 char:1 + $service.InstallProductKey($key) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : WMIMethodException
只是想知道我做错了什么?