Windows Activation Powershell Script
$computer = gc env:computername
$key = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"
$service = get-wmiObject -query "select * from SoftwareLicensingService" -computername $computer
$service.InstallProductKey($key)
$service.RefreshLicenseStatus()
Taken from http://blogs.technet.com/b/rgullick/archive/2013/06/13/activating-windows-with-powershell.aspx. This has just worked for me when activating machines a couple of days ago
Related videos on Youtube
AceHigh
High-school techie who works with NetLiteracy. Member of FRC. I manage servers and intranets in my free time after-school.
Updated on September 18, 2022Comments
-
AceHigh over 1 year
I'm looking for a method to automate activation Windows 7 machines through PowerShell. We get approximately 50 computers a month and it's slowly increasing, so manual activation is no longer possible with our deadlines. We're on a network where we can't run VAMT while connecting our server to the internet. We would prefer a script that could be written with a program and distributed via FTP. We already have the program framework, so we just need the script.
We're open to any other options as well, so long as they don't involve servers. We don't have the manpower to maintain another server on our local network.
We're using this right now:
slmgr.vbs /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX slmgr.vbs /ato
This does not successfully activate the machines with the product keys we have.
Thanks in advance!
-
Ƭᴇcʜιᴇ007 over 9 yearsWindows Vista+ attempts to automatically activate by default. Has this been disabled on your image or something? What edition of Windows 7 are you using? Which license type -- OEM, Retail, MAK, KMS?
-
AceHigh over 9 yearsWe are using Windows 7 pro, OEM keys.
-
Patrick R. over 9 yearsAre you using WDS to set the machines up?
-
AceHigh over 9 yearsYes, we're using WDS.
-
-
malakrsnaslava almost 6 yearsWorks on server 2016 SE