在脚本中激活Windows 10?

时间:2017-03-07 19:13:22

标签: powershell

$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

只是想知道我做错了什么?

0 个答案:

没有答案