Slmgr Command Examples: Master Windows Licensing with This Tool

Slmgr Command

Slmgr, which stands for Software Licensing Manager, is a Windows command-line tool used to manage Windows activation and licensing tasks. You can use the slmgr command to check license status, activate Windows, and install or uninstall license keys.

Command Options

/dliDisplay the information on the current license with activation status.
/dlvWork like /dli but provide more information about the license.
/rearmExtends the trial period of Windows.
/xprDisplay the expiration date of the Windows license.
/atoAttempts to activate the Windows using the product key that is currently installed on the system.
/ipk <product_key>Installs a new product key.
/upkUninstall the product key.
/cpkyRemoves the product key from the Windows registry.
/skms <ServerName>Specifies the KMS server that your computer will contact for activation.
/skmsport <PortNumber>Specifies the port number that your computer will use to connect to the KMS server. The default port is 1688.
/ckmsRemoves details of the previously configured KMS Server and sets the port to default.

When you run the slmgr command without any parameters, it displays the command syntax and available options.

Examples

This section provides examples of the slmgr commands. Open a Command Prompt or PowerShell with administrative privileges and then run the commands according to your requirements. Improper use of these commands can lead to licensing problems.

How to View Your Windows License Information

You can use the following command to display the current license information, including activation status and a partial product key:

slmgr /dli

Your Windows license information will be displayed through a dedicated window.

How to View Windows License status using the slmgr command
Windows License status

Enter the following command to display more detailed information about the current license:

slmgr /dlv

How to Use slmgr to Check Windows License Expiration

You can find the expiration date of your current Windows license by entering the following command:

slmgr /xpr

Running the command on my Windows 10 PC resulted in the following message, indicating that Windows is permanently activated.

Windows License Expiration on Windows 10
Windows 10

The expiration date was displayed on a Windows Server 2022 machine using an evaluation license.

Windows License Expiration on Windows Server 2022
Windows Server 2022

Extend the Evaluation Period for Windows

If your Windows trial period ends, you can use the /rearm command to extend the trial:

slmgr /rearm

Normally, the Windows Server trial period lasts 180 days for Standard and Datacenter editions. Rearming it for the first time adds another 180 days. Subsequent rearms add 90 days each, allowing for a total trial period of up to 540 days (this may vary depending on the Windows version).

Extend the Evaluation Period for Windows
Rearm

Manually Activate Windows with /ato

If your product key is not activated, you can run the following command to activate it:

slmgr /ato

Windows usually activates automatically during installation or when a valid product key is entered. However, if activation fails for some reason, you can use the /ato command to manually attempt activation with the current product key.

Adding and Removing Windows License Keys

Use the /ipk option to enter a new product key or update the existing one. In the following example, ABCDEF-12345-ABCDEF-12345-ABCDEF is the product key being entered:

slmgr /ipk ABCDEF-12345-ABCDEF-12345-ABCDEF

To remove a product key, run the following two commands:

slmgr /upk
slmgr /cpky

The first command uninstalls the product key, while the second command clears the registry of any remaining key information.

Managing KMS Activation with slmgr Commands

By default, Windows clients automatically attempt to discover KMS servers on a Windows network. However, using the /skms option overrides this behavior and forces the client to connect to a specific KMS host.

The following example sets the KMS host server to kms.example.local and specifies the port as 1688 (the port number is optional, with 1688 being the default port):

slmgr /skms kms.example.local:1688

To clear the configured KMS server and port settings, enter the following command:

slmgr /ckms

That brings us to the end of this article on using the slmgr command to manage Windows licensing and activation. We've covered everything from viewing license information to installing keys using various command options.