Unable to install product key and activate Windows 10 with PowerShell RRS feed

  • Question

  • Hi,

    I'm having issues activating certain machines using the following PowerShell script:

    $computer = gc env:computername
    $key = (Get-WmiObject -query select * from SoftwareLicensingService’).OA3xOriginalProductKey
    $service = get-wmiObject -query select * from SoftwareLicensingService -computername $computer

    The following error appears:

    Exception calling "InstallProductKey" : ""
    At line:7 char:1
    + $service.InstallProductKey($key)
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : WMIMethodException

    If I just run the 2nd line in the script to obtain the key and enter this manually using the GUI, this works OK. The script is being ran from PowerShell ISE with elevated privileges and a local admin account. I've seen a few other thread which have mentioned hardcoding the key instead of using a variable, but this was to no avail.

    Friday, May 26, 2017 8:00 PM

All replies

  • Hi Dr. Deployment,

    Sorry this is a bit late.

    Have you tried 




    May help.

    Thanks, Tim.

    Thanks, Tim. | Please remember to mark the replies as answers if they help. |

    Friday, July 28, 2017 10:48 PM