slmgr command in windows
Activate, remove, change, or extend a Windows license
What to Know
- Open Command Prompt and enter the desired slmgr command.
- Check activation status: enter slmgr /xpr. View license info: enter slmgr /dlv. Reset timers, enter slmgr /rearm.
- Use a similar format for other commands.
This article explains how to enter slmgr commands in Windows to turn on advanced Windows activation tasks.
Where to Enter Slmgr Commands
While Slmgr.vbs is stored in the System32 and SysWOW64 folders, commands that interface with the file need to be entered into Command Prompt.
Slmgr Command Examples
After opening Command Prompt, enter the desired slmgr command like you see in these examples:
Check Activation Status
slmgr /xpr
Use this slmgr command to see if Windows is activated. You'll see a message that says Windows is activated if it is, or be given a date if it's not permanently activated, or see an error if no product key has been provided.
A regular Command Prompt can work for some of these tasks but others—ones that involve changing data and not just displaying it—require an elevated Command Prompt.
View Current License Info
slmgr /dli
With this slmgr command, you’ll see part of the product key being used on your computer and an indication of whether the license is active. Other details are included here, too, like the KMS machine IP address, activation renewal interval, and other Key Management Services (KMS) information.
View Detailed License Info
slmgr /dlv
This command for slmgr.vbs reveals a lot more information about your computer. It starts off with the Windows version number and follows with the activation ID, extended PID, installation ID, remaining Windows rearm and SKU count, and a few other details on top of what the /dli option shows.
Reset Activation Timers
slmgr /rearm
The rearm command resets activation timers, which essentially lets you use Windows without activating it by extending the trial. For example, if you're using Windows on a 30-day trial, this one-month limitation can be reset back to the beginning after entering this slmgr command.
A restart of your computer is required to complete this command.
There's a limit to how many times you can rearm the Windows activation files. Check the rearm count with the /dlv command above to see how many cycles are left.
Remove Windows Product Key
slmgr /cpky
Use this slmgr command to remove the product key from Windows Registry. Doing this will not delete the key from your computer or un-activate Windows, but it will prevent key finder programs and malicious tools from being able to retrieve the key.
Activate Windows Online
slmgr /ato
This slmgr command forces Windows to try online activation, which is useful if you attempted normal activation steps (not using Slmgr.vbs) but received a connection problem or similar error.
Change Windows Product Key
slmgr /ipk 12345-12345-12345-12345-12345
Change the Windows product key with this slmgr command. Replace those numbers with the real product key, but be sure to include the dashes. Restart the computer to fully apply the new key.
If the key isn't correct, you'll see a message that The Software Licensing Service reported that the product key is invalid.
Change Remote Product Key
slmgr /ipk mattpc Matt P@ssw0rd 12345-12345-12345-12345-12345
This command is the exact same as the slmgr /ipk command shown above but instead of executing the change product key request on the local computer, it's performed on the machine named mattpc with the Matt admin users' login credentials.
Deactivate Windows
slmgr /upk
A fitting last example for the slmgr command in Windows is this one, which will uninstall the product key from the local computer. Just reboot your computer after you see the Uninstalled product key successfully message.
Slmgr Commands
The above examples are fairly basic and should be the only ones most people need to use. However, if you require more advanced options, take a look at the slmgr command syntax and the other supported options:
slmgr [MachineName [username [password]]] [option]
Slmgr Command Options | |
---|---|
Item | Explanation |
MachineName | The machine to administer. Defaults to the local machine if omitted. |
username | The username of an administrator account on the remote machine. |
password | The password for username. |
/ato | Activate Windows license and product key against Microsoft's server. |
/atp Confirmation_ID | Activate the product with a user-provided Confirmation_ID. |
/cdns | Disable DNS publishing by the KMS host. |
/ckhc | Disable KMS host caching. |
/ckms | Clear the name of KMS server used to default and port to default. |
/cpky | Delete the Windows product key from Windows Registry. |
/cpri | Set the KMS priority to low. |
/dli | Display the current license information with activation status and partial product key. |
/dlv | Display additional license information. Similar to /dli but more detailed. |
/dti | Display Installation ID for offline activation. |
/ipk key | Change the Windows product key. Replaces the current product key if present. |
/ilc file | Install a license file. |
/rilc | Reinstall system license files. |
/rearm | Reset the evaluation period/licensing status and activation state of the computer. Use /rearm-app to specify an app, or /rearm-sku for a specific sku. |
/skms | Set the Volume Licensing KMS server and/or the port used for KMS activation. |
/skhc | Enable KMS host caching (enabled by default). This blocks the use of DNS priority and weight after the initial discovery of a working KMS host. |
/sai interval | Sets the interval in minutes for unactivated clients to attempt KMS connection. |
/spri | Set the KMS priority to normal (default). |
/sprt port | Set the port on which the KMS host listens for client activation requests (default TCP port is 1688). |
/sdns | Enable DNS publishing by the KMS host (default). |
/upk | Uninstall the currently installed Windows product key and return the license status back to a trial state. |
/xpr | Show the expiry date of the current license or indicate whether activation is permanent. |
The MachineName option can't be used across platforms. For example, you can't manage Windows activation on a Windows 7 computer from a Windows Vista computer.
Slmgr Uses
Software Licensing Management Tool (slmgr) is a VBS file in Windows against which you can run commands to perform advanced Windows product activation tasks.
Slmgr.vbs is used only for the Windows operating system. Ospp.vbs manages volume licensing for Microsoft Office products.