Windows Activation Commands

powershell windows

Here are a list of operations I find useful for dealing with windows activation from the console.

CSCRIPT instead of WSCRIPT

One thing that might start to get annoying is slmgr.vbs is a VBScript. What this means is when you run it, it is going to put up a heap of message boxes.

To avoid this you can change the default WHS runner to cscript instead of wscript. To do that run the following command from an elevated command prompt:

cscript //H:CSCRIPT

If you want to change this back to WScript later simply run the following instead:

cscript //H:WSCRIPT

Check activation status

To check the activation status of Windows you can run the following from an elevated console.

slmgr.vbs -dlv

This will then show you details of the license and if the system is activated or not. Pay attention to the License Status property to see if windows is activated or not.

How to enter a product key.

slmgr.vbs -ipk <product key here>

Wait a few moments after you enter this command. Then enter the following which will instruct windows to go online to complete the activation:

slmgr.vbs -ato

If it fails you will be given a command to type in to get the error message. A lot of the time this can fail because you tried it too soon or if the key was bad.

Check current expiry date

slmgr.vbs -xpr

This will list when the license will expire. In a lot of cases it will auto renew before that date.

Remove activation

slmgr.vbs -upk

Set KMS server

slmgr.vbs -skms <hostname>:[port]

Port is only required if non standard port is used.

Clear KMS server

slmgr.vbs -ckms

Extend Trial Period

slmgr.vbs -rearm

You can see how many rearms you have by using

slmgr.vbs -dlv