Mastering the Slmgr Command in Windows: A Comprehensive Guide

Explore how to manage Windows licenses with slmgr commands for activation, modification, and troubleshooting

What to Know

  • Use the slmgr command in Windows to manage your computer's license and activation settings easily.
  • Enter slmgr commands in Command Prompt to check activation status, view license info, or change the product key.
  • Be sure to run Command Prompt as an administrator when using slmgr commands that change data.

This article explains how to use slmgr commands in Windows for advanced 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.

Result from Windows Script Host showing activation status after executing slmgr xpr

Slmgr Command Examples

After opening Command Prompt, enter the desired slmgr command as shown 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.

An elevated Command Prompt is required for commands that change data.

View Current License Info

 slmgr /dli

This command shows part of the product key and an indication of whether the license is active. Other details might be included here, too, like the Key Management Services (KMS) machine IP address, activation renewal interval, and other KMS information.

View Detailed License Info

 slmgr /dlv
windows script host prompt with software licensing 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.

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 necessary 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

This command removes the product key from the Windows Registry. It will not delete the key from your computer or deactivate Windows, but it will prevent key finder programs and malicious tools from accessing the key.

Activate Windows Online

 slmgr /ato

This 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 using this slmgr command. Replace the placeholders with the actual product key and include the dashes. Restart your computer to apply the new key fully.

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

As a final example, this slmgr command uninstalls the product key from the local computer. Simply reboot your computer after receiving 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.
/lil List installed token-based activation issuance licenses.
/ril Remove installed token-based activation issuance license.
/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.

MachineName 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 exclusively for the Windows operating system. Ospp.vbs handles volume licensing for other Microsoft products.

Frequently Asked Questions

  • How do I open the command prompt?

    To open the command prompt in Windows 11 or 10, go to Start, type cmd, and select Command Prompt from the list.

  • How do I run the command prompt as an admin?

    Go to Start and type cmd. Right-click Command Prompt > Run as administrator. If you see a User Account Control window, select Yes to give permission to continue.

  • How do I clear the command prompt?

    To clear the Windows command prompt screen, type CLS > press Enter. This will clear the entire application screen. You can also close and reopen the command prompt to clear it.

Was this page helpful?

Related Articles