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

  • Anonymous
    June 18, 2015
    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?
  • Anonymous
    June 30, 2015
    You don't put your computer name in the script. $computer = gc env:computername will find your computers name from the environment settings.
  • Anonymous
    December 12, 2015
    Great script - saved my bacon when I couldn't activate Windows 10 using the GUI
  • Anonymous
    January 20, 2016
    hope this work for me. because I am doing an image.