r/usefulscripts • u/feldrim • Oct 26 '22
[PowerShell] Using PowerShell for KMS activation, instead of slmgr.vbs
It's a drop-in replacement for slmgr.vbs script. Today I stumbled upon the script I created and shared here 2 years ago. I checked that and made some improvements.
The differences from slmgr.vbs:
You can provide an array of computer names, and it is up to you how you get them. It's just PowerShell.
It works on PowerShell version 5.0 and above. It means PowerShell 7.0 is ok, too.
It uses WinRM for remote computers. Check if remote computers are accessible over WinRM.
It includes a list of KMS keys, so that you don't have to for most of them. It covers some of the versions, not all of them.
It works even if you disabled
cscriptandwscript.The code is documented and readable, so that you can improve according to your needs.
Gist:
It's a drop-in replacement for slmgr.vbs script (github.com)
5
u/feldrim Oct 26 '22
If you need to activate, you had to:
Find the key for your product
Type
slmgr.vbs /ipk <5x5 key for the product>Type
slmgr.vbs /atoRepeat the same for each host locally
With this cmdlet, you trigger the activation by just typing
Start-WindowsActivation -Computer <array of hostnames>remotely if WinRM is configured on the target. Or you can just do the same locally withStart-WindowsActivation.