Windows Activation Powershell Script

powershellwindows-activation

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!

Best Answer

$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 Question