Activating Windows with PowerShell


You want to activate Windows using PowerShell?  Here you go:

$computer = gc env:computername

$key = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"

$service = get-wmiObject -query "select * from SoftwareLicensingService" -computername $computer

$service.InstallProductKey($key)

$service.RefreshLicenseStatus()

 

Note: $key will be followed by your legally obtained product key 🙂 

Comments (4)

  1. Kyle Amidon says:

    This is great, but it didn’t work for me…i put their computer name where it says computer name and I keep getting errors. This is for remote activation correct?

  2. You don’t put your computer name in the script. $computer = gc env:computername will find your computers name from the environment settings.

  3. Peter Retief says:

    Great script – saved my bacon when I couldn’t activate Windows 10 using the GUI

  4. Dave says:

    hope this work for me. because I am doing an image.

Skip to main content