How to Use the Slmgr Command in Windows
Software Licensing Management Tool (slmgr) is a VBS file in Windows against which you can run commands to perform advanced Windows activation tasks.
You don't need to use Slmgr.vbs to activate Windows or change the product key, but you might need to if the normal activation process fails or if you get strange "Windows is not genuine" errors.
While the Slmgr.vbs file is stored in the System32 and SysWOW64 folders, commands that interface with the file need to be entered into Command Prompt.
TIP: Slmgr.vbs is used only for the Windows operating system. Ospp.vbs manages volume licensing for Microsoft Office products.
Slmgr Command Examples
slmgr [MachineName [username [password]]] [option]
After opening Command Prompt, enter the desired slmgr command like you see in these examples:
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.