首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Powershell激活Windows10 WMIMethodException

Powershell激活Windows10 WMIMethodException
EN

Stack Overflow用户
提问于 2018-01-11 21:16:44
回答 2查看 6.5K关注 0票数 0

我正在尝试用PowerShell激活Windows10。

我得到了以下脚本:

代码语言:javascript
复制
$computerName = $env:COMPUTERNAME
$key = "[Windows 10 product key is in here]"
$activationService = Get-WmiObject -Query "select * from SoftwareLicensingService" -ComputerName $computerName
$activationService.InstallProductKey($key)
$activationService.RefreshLicenseStatus()

但我一直收到以下异常:

代码语言:javascript
复制
Exception calling "InstallProductKey" : ""
At F:test.ps1:4:1
+ $activationService.InstallProductKey($key)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : WMIMethodException

我看起来就是搞不懂。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2018-01-11 21:31:07

语法是正确的!我使用以下命令激活了我的笔记本

代码语言:javascript
复制
$computer = gc env:computername
$key = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"
$service = get-wmiObject -query "select * from SoftwareLicensingService" -computername $computer
$service.InstallProductKey($key)
$service.RefreshLicenseStatus()
票数 1
EN

Stack Overflow用户

发布于 2019-04-11 05:44:49

以管理员身份启动cmd并运行:

代码语言:javascript
复制
slmgr.vbs /ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48208029

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档