Thousands of licences delivered

Activate Windows with slmgr: which commands do you use?

MBMira Bakker· Microsoft specialistLast updated: 12 July 2026· 8 min read
Quick answer

You activate Windows with slmgr in an elevated Command Prompt: install the key with slmgr /ipk and activate online with slmgr /ato. With slmgr /dli, /dlv and /xpr you read the licence status, edition and expiry date. For volume licences, set the KMS server with slmgr /skms.

Person typing commands in a Command Prompt on a laptop

Use slmgr to install, activate and check a Windows licence from the command line.

slmgr stands for Software Licensing Management Tool. It is a VBScript file (slmgr.vbs) located in the C:\Windows\System32 folder that you call with a switch such as /ato or /dli. Where graphical activation in Settings offers only a few buttons, slmgr gives you precise control: you can see the licence channel, expiry date and activation ID, and you can install or remove product keys.

The tool is especially useful when normal activation returns an error, when you want to check a key before using it, or when you activate a PC via a KMS server on a corporate network. All commands work identically on Windows 10 and Windows 11.

There is also a variant that works with a graphical interface: slui. This command opens windows, for example slui 3 for entering a key and slui 4 for telephone activation. slmgr is the text-based version that offers more options and is suitable for scripts and remote management. For one-off activation, the graphical route is enough; if you want to read out, log or automate, slmgr is the logical choice.

Important to know: slmgr does not change any of your files or programs. It only touches the licence status. You can therefore safely use the commands to query information without changing anything; only commands such as /ipk, /ato, /upk and /rearm actually modify the activation.

Always run slmgr in an elevated Command Prompt with administrator rights.

slmgr changes system settings and refuses to work without elevated rights. Therefore open an elevated prompt first:

  1. Click Start and type cmd.
  2. Right-click Command Prompt and choose Run as administrator.
  3. Confirm the User Account Control prompt with Yes.

By default, slmgr opens the output in a pop-up window (via Windows Script Host). If you prefer to see the text in the console itself so you can copy or log it, call the script with cscript:

cscript //nologo C:\Windows\System32\slmgr.vbs /dlv

This syntax suppresses the banner window and shows all lines in the Command Prompt. For occasional use, the shorter slmgr /dlv is sufficient. Windows PowerShell opened as administrator also works, provided you supply the full path to the script or simply call slmgr. It does not matter for the commands themselves whether you use Command Prompt or PowerShell; only the way you open the prompt differs.

Light corner of a room with a grey floor: an all-in-one computer on a white desk, a black desk mat with a white keyboard and white mouse, a lamp and a green plant.
You run slmgr commands in a Command Prompt that you have opened as administrator.

These are the slmgr switches you use most often.

Each switch starts with a forward slash. The overview below contains the commands you need most in practice:

CommandWhat it does
slmgr /ipk <key>Installs a 25-character product key
slmgr /atoActivates Windows online with Microsoft
slmgr /dliShows brief licence information
slmgr /dlvShows detailed licence information
slmgr /xprShows whether and when activation expires
slmgr /upkRemoves the installed product key
slmgr /cpkyClears the product key from the registry
slmgr /rearmResets the grace period (restart required)
slmgr /skms <host>Sets the KMS server for volume activation

The switches fall broadly into three groups. The first group manages keys: /ipk installs one, /upk removes the active key and /cpky clears the trace from the registry. The second group is about activation: /ato activates online and /rearm resets the grace period counter. The third group only reads out: /dli, /dlv and /xpr show information without changing anything.

If you do not want to activate a key yet but first want to check the channel (Retail, OEM or Volume), use /dli. The channel tells you how the licence was obtained and whether it is transferable.

Activate Windows with slmgr in two commands.

To activate a fresh or non-activated Windows installation, first install the product key and then start online activation:

slmgr /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
slmgr /ato

Replace the series of Xs with your own 25-character key. The /ipk command installs the code silently, even if an old key was already active. Microsoft recommends restarting the PC after installing a new key before you activate. The /ato command then forces an activation attempt with Microsoft's servers.

If you get an error code after /ato, it is rarely caused by slmgr itself but by the key or the network connection. With the common error code 0xC004C003, for example, the key is blocked; how to resolve that is described in Fix Windows activation error 0xC004C003.

If you want to remove the old key cleanly before installing a new one, for example because you typed the wrong code, use this order:

slmgr /upk
slmgr /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
slmgr /ato

The first command removes the existing product key, after which Windows is temporarily not activated. You then install the new key and activate again. This approach prevents an incorrect or rejected key from remaining in the way.

Read the activation status with /dli, /dlv and /xpr.

After activation, you want to confirm that everything is correct. Three commands provide the information for that:

  • slmgr /dli shows the edition, part of the product key, the channel and the licence status in brief.
  • slmgr /dlv adds the activation ID, installation ID, remaining rearm counter and SKU data.
  • slmgr /xpr reports in a single line whether Windows is permanently activated or when activation expires.

On a validly activated retail or OEM installation, /xpr reports that the machine is permanently activated. With a volume licence via KMS, you see an expiry date instead, usually 180 days ahead, which is automatically renewed each time.

The output of /dli shows, among other things, the edition name, the last five characters of the product key and a line with the licence status, for example that the licence is valid. If you see a status such as expired or in the grace period, there is still work to do. For security reasons, slmgr never shows the full product key; you only see the last block, enough to tell keys apart.

For volume licences, set the KMS server with /skms.

In corporate networks, computers do not activate individually with Microsoft, but against a local KMS server (Key Management Service). You specify that server and then start activation:

slmgr /skms kms.yourcompany.co.uk:1688
slmgr /ato

Port 1688 is the default port for KMS traffic. If activation works, a confirmation appears with the number of activated clients. If you later want to clear the configured KMS host, use slmgr /ckms.

If the grace period expires and you want to reset it once, slmgr /rearm does that. The counter is limited: you can reset the grace period only a few times, after which real activation is required. Restart the PC after this command for the change to take effect. The remaining number of times you can rearm is shown in the output of slmgr /dlv on the line about the rearm counter.

KMS activation is deliberately temporary. As long as the client reaches the KMS server at least once every 180 days, activation renews automatically. If a laptop is outside the corporate network for a long time, activation can expire; a short connection to the network and a new slmgr /ato put it right again.

Run slmgr on another PC by supplying the computer name.

slmgr can control a PC remotely within the same network. You pass the computer name and, if necessary, a user name and password before the switch option:

slmgr WORKSTATION07 administrator Password123 /dli

This queries the licence status of the machine WORKSTATION07 without you having to be physically present. This is useful for a system administrator who manages dozens of workstations. The remote PC must be reachable and the account used must have administrator rights there. If you leave out the user name and password, slmgr uses the rights of your current logon.

For larger numbers of machines, administrators often automate this in a script that loops through a list of computer names and runs /dli or /ato for each machine. That way you can see at a glance which workstations are not yet activated.

Resolve slmgr errors by checking rights, key and network.

Most problems with slmgr are caused by one of three things. Check them in this order:

SymptomLikely causeWhat you do
Access denied / nothing happensPrompt not opened as administratorClose it and open again with Run as administrator
0xC004F050Invalid or incorrect keyCheck the 25 characters and the corresponding edition
0xC004C003Key blocked or already in useReplace the key or activate by phone with slui 4
0x8007232BKMS server not foundCheck the host name and port 1688

If online activation does not work, try telephone activation: press Windows + R, type slui 4 and follow the spoken instructions. The complete list of switches and their exact behaviour is in the Microsoft Learn documentation.

A final common case: after activation, /xpr keeps reporting that Windows is not activated even though no error code appeared. Then restart the PC first, because a newly installed key is not always applied immediately. If the problem persists, rebuilding the licence files with slmgr /rilc, followed by a restart and a new attempt with /ato, often helps. This resolves damaged or stuck licensing data without changing the key itself.

Frequently asked questions

slmgr stands for Software Licensing Management Tool. It is a VBScript file (slmgr.vbs) in the Windows System32 folder that lets you install a product key, activate Windows and read the licence status from the command line. The commands work identically on Windows 10 and Windows 11.

Open an elevated Command Prompt and first run slmgr /ipk followed by your 25-character key to install the product key. Then run slmgr /ato to activate Windows online with Microsoft's servers. Restart the PC if the key has just been changed.

Run slmgr /xpr for a short message stating whether Windows is permanently activated or when activation expires. For more detail, use slmgr /dli for the channel and edition, or slmgr /dlv for the activation ID, installation ID and rearm counter.

slmgr requires administrator rights. If nothing happens or you get an Access denied message, the prompt has not been opened elevated. Close it and open Command Prompt again by right-clicking and choosing Run as administrator. By default, the output appears in a separate pop-up window.

Run slmgr /upk to remove the installed product key; Windows is then no longer activated until you install a new key. If you also want to clear the trace from the registry, for example before selling a PC, also use slmgr /cpky.

Yes, for volume licences you specify the KMS server with slmgr /skms, followed by the host name and port 1688. Then slmgr /ato starts activation with that server. Activation is then usually valid for 180 days and is renewed automatically as long as the server is reachable.

Related articles

MB
Mira Bakker
Microsoft specialist

Mira supports businesses with Windows and Office deployments and resolves activation, licensing and error code questions on a daily basis.

View profile
Looking for a licence for this software?
Explore the Liceon collection. Instant delivery, genuine licences.
View the collection