You can activate Windows from Command Prompt using the built-in slmgr (Software License Manager) script. The most direct command is slmgr /ato, which tells Windows to activate online using the product key already installed on the PC. If no key is present, you first install one with slmgr /ipk <product-key>, then run slmgr /ato. These commands only work with a genuine, legally obtained product key or a valid digital license tied to your Microsoft account or hardware. They do not bypass activation, and using them with pirated keys or unofficial activation tools is illegal and often flagged by Microsoft.
What You'll Need
- A Windows PC running Windows 10 or Windows 11 (the commands also exist in Windows 8.1 and 7, but support has ended).
- An administrator account. The Command Prompt must be opened as Administrator.
- A valid 25-character product key (if Windows is not already activated via a digital license).
- An internet connection for online activation.
Step-by-Step
- Open Command Prompt as Administrator. Click Start, type
cmd, right-click “Command Prompt” and choose “Run as administrator”. On Windows 11 you can also right-click the Start button and select “Terminal (Admin)” or “Command Prompt (Admin)”. Accept the User Account Control prompt. - Check current activation status. Type
slmgr /xprand press Enter. A dialog box will tell you whether Windows is permanently activated or still in the grace period. This confirms whether you need to activate at all. - Install your product key (if needed). If Windows is not activated and you have a key, type
slmgr /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXXreplacing the Xs with your actual key. Press Enter. You should see a message that the product key installed successfully. If you already have a digital license linked to your Microsoft account, skip this step. - Activate online. Type
slmgr /atoand press Enter. Windows will contact Microsoft’s activation servers. A message will confirm successful activation or report an error code. - Verify activation. Run
slmgr /xpragain. It should now say “The machine is permanently activated.” You can also check Settings > System > Activation (Windows 11) or Settings > Update & Security > Activation (Windows 10) for a visual confirmation. - Restart if prompted. Some changes take effect after a reboot. Restart the PC normally.
Note: Menu labels and dialog wording can differ slightly between Windows versions and regions. The slmgr commands themselves are consistent across Windows 10 and 11.
Common Mistakes
- Running Command Prompt without administrator rights. slmgr will fail with an access-denied or “not enough privileges” error. Always use “Run as administrator”.
- Typing the product key incorrectly. Keys contain letters and numbers; confusing 0 (zero) with O or 1 with I is common. Copy and paste the key if possible, but avoid including spaces.
- Using a key that is already in use on another PC. Retail keys can be moved, but OEM keys are tied to the original motherboard. Activation will fail with an error about the key being in use.
- Expecting slmgr to bypass activation. It cannot. It only manages legitimate licenses. Any “activator” or KMS emulator is piracy and may install malware.
- Forgetting to check the edition. A key for Windows 11 Pro will not activate Windows 11 Home. Use
slmgr /dlvto see the edition and license type currently installed.
Tips
- Use
slmgr /dlvto see detailed license information, including the partial product key and activation ID. This helps when troubleshooting. - If you have a digital license linked to your Microsoft account, sign in with that account in Settings > Accounts and run
slmgr /ato; Windows can retrieve the license automatically. - For volume-licensed machines in a business setting, activation may use a KMS server. The command
slmgr /skms <server>sets the KMS server, but only do this if your IT department instructs you. - Keep a record of your product key. Once activated, you can retrieve the last five characters with
slmgr /dli. - Run
slmgr /?to see all available options and their syntax.
Troubleshooting
If activation fails, the error code matters. Common codes and what to try:
- 0xC004F074 – The KMS server could not be reached. Check your internet connection and firewall. If you are not on a corporate network, you likely should not be using KMS; use a retail or digital license instead.
- 0xC004C003 – The product key is blocked. The key may be pirated or invalid. Contact the seller or Microsoft support.
- 0x8007232B – DNS name does not exist. This often appears when a KMS server is misconfigured. For home users, it usually means the installed key is a volume license key that cannot activate online; you need a retail key.
- 0xC004F050 – The product key is invalid. Double-check the key for typos.
- 0x8007007B – The file name, directory name, or volume label syntax is incorrect. This often indicates a corrupted license store. Run
slmgr /rearm(requires restart) and try again.
If you see “Access denied” or “You do not have sufficient privileges”, close Command Prompt and reopen it as Administrator. If activation still fails, run the Activation troubleshooter: Settings > System > Activation > Troubleshoot (Windows 11) or Settings > Update & Security > Activation > Troubleshoot (Windows 10). If the troubleshooter cannot fix it, contact Microsoft support with your error code and proof of purchase.
Warning: Commands like slmgr /rearm reset the activation timer and can be used a limited number of times. Do not run them repeatedly. Never use third-party “activation scripts” from unofficial sites; they are a common malware vector.
Frequently Asked Questions
Can I activate Windows without a product key?
Only if your PC has a digital license linked to your Microsoft account or embedded in the hardware (common on laptops that came with Windows preinstalled). In that case, slmgr /ato will activate automatically. Otherwise, a valid key is required.
What does slmgr /ato do?
It attempts online activation using the product key currently installed on the system. It contacts Microsoft’s activation servers and, if the key is valid and not in use elsewhere, activates Windows.
Is using slmgr legal?
Yes, slmgr is a legitimate Microsoft tool for managing licenses. However, using it with pirated keys or to bypass activation is illegal and violates Microsoft’s terms.
Why does slmgr say “not enough privileges”?
You did not open Command Prompt as Administrator. Close it and reopen with “Run as administrator”.
Can I use slmgr on Windows 7 or 8?
The commands exist, but Microsoft no longer supports those versions, and online activation may fail. Upgrade to Windows 10 or 11 for continued support.
How do I find my product key?
If Windows is activated, run slmgr /dli to see the last five characters. For the full key, check your purchase email or the sticker on your PC (for OEM licenses). Third-party key finder tools are not recommended.