【问题标题】:Powershell activate Windows 10 WMIMethodExceptionPowershell 激活 Windows 10 WMIMethodException
【发布时间】:2018-06-20 20:09:16
【问题描述】:

我正在尝试使用 PowerShell 激活 Windows 10。

我得到了以下脚本:

$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()

但我不断收到以下异常:

Exception calling "InstallProductKey" : ""
At F:test.ps1:4:1
+ $activationService.InstallProductKey($key)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : WMIMethodException

我似乎无法做到这一点。

【问题讨论】:

    标签: powershell


    【解决方案1】:

    语法正确! 我使用以下内容来激活我的笔记本

    $computer = gc env:computername
    $key = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"
    $service = get-wmiObject -query "select * from SoftwareLicensingService" -computername $computer
    $service.InstallProductKey($key)
    $service.RefreshLicenseStatus()
    

    【讨论】:

      【解决方案2】:

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

      slmgr.vbs /ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
      

      【讨论】:

        猜你喜欢
        • 2019-01-13
        • 2020-08-12
        • 2015-11-09
        • 2019-04-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-12-21
        相关资源
        最近更新 更多