How to Activate Windows 11 With CMD Using slmgr Commands

//

Michael Collins

To activate Windows 11 from Command Prompt, open Command Prompt as an administrator, type slmgr /ipk followed by your 25-character product key, press Enter, then run slmgr /ato to send the activation request to Microsoft. Run slmgr /dli afterward, or open Settings > System > Activation, to confirm that Windows now reports itself as activated.

These instructions apply to Windows 11 Home and Pro with a genuine product key you own (a retail key, or a key that came with the PC or in a Microsoft order email). The same commands work on Windows 10, which reached end of support on October 14, 2025. Work and school PCs that activate through an organization’s volume license are managed by their IT department and are not covered here.

What Command Prompt Activation Can and Cannot Do

The command slmgr runs the Software Licensing Management Tool (slmgr.vbs), a script built into every copy of Windows. It talks to the same activation service as the Activation page in Settings. That means it can install a key, start activation, show license details and remove a key, but it cannot create a license. A product key you bought, or a digital license Microsoft already has on record for the PC, is still required.

Many people searching for this do not need a command at all. A PC that came with Windows 11, or a PC that upgraded from an activated copy of Windows 10, usually holds a digital license (a license tied to the hardware, and often to a Microsoft account). It activates by itself once it connects to the internet, with no key to type. If you are not sure which situation you are in, check the activation status first (next section).

Your situation What to do
Settings says Windows is activated Nothing. No command is needed.
You have a 25-character key from a box, sticker, card or order email Use the slmgr steps below, or Change product key in Settings.
The PC upgraded for free from activated Windows 10 Connect to the internet and wait, or run slmgr /ato once to retry.
You replaced the motherboard Use the Activation troubleshooter (see the troubleshooting section).
You have no key and no license Buy a license. A command cannot activate Windows without one.

A word about the “activation commands” passed around online: most of them install a generic KMS client key and point Windows at a stranger’s KMS server with slmgr /skms, or wrap that inside a downloaded script. Microsoft’s own list of KMS client setup keys explains that these keys exist for organizations with volume licensing and their own KMS host on the local network, and that they cannot be used as a retail license. Using a public KMS server or a third-party activator to switch on Windows without paying for it is unlicensed use, and running unknown scripts with administrator rights is a security risk. Leave them alone. If cost is the problem, read about the free ways to license Windows 11 that Microsoft allows, such as the upgrade from an eligible, activated Windows 10 PC.

Illustration comparing legitimate ways to activate Windows 11 with unlicensed shortcuts such as public KMS servers and activator scripts
Illustration: which activation routes are licensed and which are not.

Check Whether Windows 11 Is Already Activated

Open Start > Settings > System > Activation and look at the line next to Activation status. Microsoft lists these messages:

  • Windows is activated
  • Windows is activated with a digital license
  • Windows is activated with a digital license linked to your Microsoft account
  • Windows is not activated

From Command Prompt, slmgr /dli shows the edition, a partial product key and the License Status line. slmgr /xpr shows whether activation expires; on a PC with a retail key or a digital license it reports that the machine is permanently activated, because Microsoft treats retail activation as perpetual. Both of these read-only commands work in an ordinary Command Prompt window, without administrator rights. To read the key stored in firmware before activating, try the PowerShell query in this Windows 11 product key guide.

Activate Windows 11 With slmgr in Command Prompt

Have your product key ready before you start. It is 25 characters in five groups of five (XXXXX-XXXXX-XXXXX-XXXXX-XXXXX). If you cannot find it, the guide to finding your Windows product key covers stickers, order emails and account records. The key must match the edition that is installed: a Home key does not activate Pro, and a Pro key does not activate Home.

  1. Select Start and type cmd. Command Prompt appears at the top of the results.
  2. Select Run as administrator in the right pane of the search results (or right-click Command Prompt and choose Run as administrator).
  3. Select Yes in the User Account Control box. The window that opens has Administrator: Command Prompt in its title bar. If it does not, close it and repeat step 2.
  4. Type slmgr /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX, using your own key with its hyphens, and press Enter. After a few seconds a small message box confirms that the key was installed. Select OK. Windows checks that the key is valid for this edition before installing it, and it replaces any key that was there before.
  5. Type slmgr /ato and press Enter. Windows contacts Microsoft’s activation servers, then shows a message box saying the product was activated, or an error code if it was not. Select OK.
  6. Type slmgr /dli and press Enter. Check that the License Status line now reads Licensed.
  7. Restart the PC. Microsoft’s slmgr documentation recommends a restart after installing a new key so the licensing service picks up the change cleanly.
Example slmgr dialog showing License Status Licensed
Illustration: Example slmgr dialog showing License Status Licensed.

The PC needs a working internet connection for step 5. If step 4 returns an error, compare the key with your source character by character before trying anything else; a single mistyped character makes the key invalid.

Why the message boxes? slmgr.vbs is a script, and Windows runs scripts through Windows Script Host, which shows alerts in pop-up windows by default. To get the text inside the Command Prompt window instead (handy for copying an error), run the same switch through the console host: cscript %windir%\system32\slmgr.vbs /dli.

If the Start search route gives you trouble, the separate walkthrough on running Command Prompt as an administrator shows the other ways to open an elevated window. Terminal (Admin) from the Windows + X menu works too; slmgr runs the same way in PowerShell.

slmgr Switches Worth Knowing

Microsoft documents dozens of slmgr options, most of them for corporate KMS and Active Directory activation. These are the ones a home user may need, taken from Microsoft’s slmgr.vbs options reference:

Command What it does Needs administrator?
slmgr /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX Installs a product key, replacing the current one Yes
slmgr /ato Starts online activation with the installed key Yes
slmgr /dli Shows the edition, partial key and license status No
slmgr /dlv Shows detailed license information, including the activation ID No
slmgr /xpr Shows the activation expiration date (or permanent activation) No
slmgr /upk Uninstalls the product key; after a restart Windows is unlicensed Yes
slmgr /cpky Removes the key from the registry so other software cannot read it Yes
slmgr /dti Shows the installation ID used for offline activation Not stated; use the elevated window
slmgr /atp plus the confirmation ID Activates with a confirmation ID from Microsoft Not stated; use the elevated window

You may also see slmgr /rearm recommended as a way to “extend” activation. It resets the activation timers and exists for system builders preparing images with Sysprep. It does not license Windows, so it is not a fix for an unactivated home PC.

Activate in Settings Instead

The Settings app does the same job without typing commands, and it is the route Microsoft’s Activate Windows help page describes:

  1. Open Start > Settings > System > Activation.
  2. Select Change product key.
  3. Enter the 25-character key and follow the prompts to activate.
Windows Activation settings showing an active license
Illustration: Windows Activation settings showing an active license.

On the same page, a PC without a license shows a button to buy one from the Microsoft Store. If you want Pro features on a Home PC, that is an edition upgrade rather than an activation problem; the article on upgrading Windows 11 Home to Pro explains when it costs nothing and when it needs a Pro key.

While you are on the Activation page, link your Microsoft account if the status does not already mention one: select Add an account and sign in with an administrator account. A linked digital license is what lets Windows reactivate after a major hardware change.

Activate by Phone When Online Activation Will Not Work

When a PC cannot reach Microsoft’s activation servers (no internet, or a firewall in the way), Microsoft offers phone activation. Type SLUI 04 in the taskbar search box, press Enter, and follow the on-screen instructions: you call the number shown, give the installation ID displayed in the window, and type in the confirmation ID you receive. Microsoft notes that phone activation is not available for Windows 11 Pro Education or Pro for Workstations.

The command line has an equivalent for the same process: slmgr /dti displays the installation ID, and slmgr /atp followed by the confirmation ID completes activation.

When Activation Fails

Start with the basics: an internet connection, the correct date and time, and a key that matches your edition. Then look up the code slmgr or Settings showed you. These are the ones Microsoft lists most often on its activation errors page:

Error code What Microsoft says it means What to try
0xC004F074 Often an Enterprise key on Home or Pro, or a work PC away from its company network Enter a key for your edition, or contact your IT department
0x803F7001 Windows could not find a valid license Enter a valid key or buy a license from the Microsoft Store
0xC004C003 The key was used, or tried, on more than one device Contact the seller or PC maker; check for a paper copy of your key
0xC004C008 The key is already in use on another PC Buy a key for each PC; after a hardware change, try phone activation
0xC004F213 No product key found, usually after a motherboard replacement Use the Activation troubleshooter or enter a key you used before
0x87E10BC6 A problem with the activation or licensing server Wait a few minutes, then run the Activation troubleshooter
0x80072F8F Wrong date and time, or a connection problem Fix the clock, then check your network

If slmgr answers with an “Access denied” message saying the action requires elevated privileges, the window is not running as administrator. Close it and reopen it with Run as administrator.

After replacing the motherboard or other hardware

A large hardware change can make Windows stop recognizing its digital license. Microsoft’s reactivation after a hardware change page describes the fix, which only works if your Microsoft account was linked to the license before the change:

  1. Sign in with an administrator account.
  2. Open Settings > System > Activation and select Troubleshoot.
  3. Select I changed hardware on this device recently, then Next.
  4. Sign in with the Microsoft account linked to the license.
  5. Find the PC in the device list, check This is the device I’m using right now, and select Activate.
Example PC selected in the Windows hardware reactivation dialog
Illustration: Example PC selected in the Windows hardware reactivation dialog.

The Troubleshoot button only appears while Windows is not activated, and the edition you reinstall has to match the one that was licensed before.

Remove a Product Key From a PC

If you are selling or giving away a PC whose retail key you plan to use elsewhere, remove the key first. In an administrator Command Prompt, run slmgr /upk to uninstall the key, then slmgr /cpky to clear it from the registry. After the next restart Windows reports that it is not activated. Removing the key does not delete your files.

To put a key back later, run slmgr /ipk and slmgr /ato again. If you are reinstalling Windows rather than moving a key, the guide to downloading Windows 11 free from Microsoft covers the installer options, and a PC with a digital license reactivates on its own once setup finishes and it goes online.

Windows 11 CMD Activation Questions

Can Command Prompt activate Windows 11 without a product key?

Only when the PC already has a digital license. In that case slmgr /ato asks Microsoft’s servers to check the existing license again, which can speed up activation after a reinstall. On a PC that has never had a license, no legitimate command can activate Windows.

Does activation prove my copy of Windows is genuine?

No. Microsoft separates the two: activation confirms that your copy is licensed for this PC, while validation is a different check that confirms the licensing files are intact. Validation is needed for some updates and downloads from Microsoft.

Do I have to restart after running slmgr /ato?

Activation takes effect as soon as the success message appears, but Microsoft recommends restarting the PC (or the Software Protection service) after installing a key with /ipk so the licensing service runs normally.

Can I paste the product key instead of typing it?

Yes. Right-click inside the Command Prompt window, or press Ctrl + V, to paste a key copied from an order email. Check that no extra space or line break came along with it before pressing Enter.