To activate Windows 11 with Command Prompt, open Terminal or Command Prompt as an administrator, type slmgr /ipk followed by your 25-character product key, and press Enter. Then type slmgr /ato and press Enter. A small window confirms each step, and slmgr /xpr tells you whether Windows is now permanently activated.
These steps work on Windows 11 Home, Pro, Enterprise, and Education, on every Windows 11 version Microsoft currently supports, and the same slmgr commands work on Windows 10. Windows 11 PCs with the September 2026 updates or later can also use Microsoft’s new PowerShell commands, covered below.
Before You Start
You need three things:
- A genuine product key for the edition you have installed. A product key is the 25-character code (XXXXX-XXXXX-XXXXX-XXXXX-XXXXX) on a retail box, a Certificate of Authenticity label, or the confirmation email from Microsoft or an authorized retailer. A Windows 11 Home key activates Home, and a Pro key activates Pro. Check your edition in Settings > System > About under Windows specifications.
- An administrator account. slmgr refuses to install a key or activate online from a standard window.
- An internet connection.
slmgr /atocontacts Microsoft’s activation servers. No connection? See the offline option in the troubleshooting section.
Many PCs don’t need a key at all. If Windows came preinstalled, or you upgraded from an activated Windows 10, the PC usually has a digital license, which Microsoft describes as activation tied to your hardware rather than to a code you type. Open Settings > System > Activation first. If it already says Active or “Windows is activated with a digital license,” you’re done.
If your PC belongs to a business or school, its IT team normally handles activation through the organization’s own licensing. Ask them before changing the key.
Activate Windows 11 With slmgr
- Right-click the Start button and select Terminal (Admin). Select Yes in the User Account Control prompt. The window title starts with Administrator, which confirms you have the rights slmgr needs.
- Type
slmgr /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX, replacing the X’s with your key (keep the dashes), and press Enter. After a few seconds a Windows Script Host box says the product key was installed successfully. If a key was already installed, this one replaces it. - Select OK.
- Type
slmgr /atoand press Enter. Windows contacts Microsoft, which can take up to a minute. A box then says the product was activated successfully. - Select OK.

- Type
slmgr /xprand press Enter. The message “The machine is permanently activated” confirms a retail or digital-license activation. - Restart the PC. Microsoft’s slmgr reference recommends a restart after you install a new key so the licensing service picks up the change cleanly.
If step 4 shows an error code instead, find it in the troubleshooting section below. These commands run the Windows Software Licensing Management Tool, a script stored at C:\Windows\System32\slmgr.vbs.
On an older PC, the Settings route is different; see how to activate Windows 10.
Prefer the classic window? Search Start for cmd, select Run as administrator, and type the same commands. Our guide on running Command Prompt as admin in Windows 11 shows other ways to open it.
Useful slmgr Commands
| Command | What it does | Needs admin? |
|---|---|---|
slmgr /ipk YOUR-KEY |
Installs or replaces the product key | Yes |
slmgr /ato |
Activates Windows online with the installed key | Yes |
slmgr /xpr |
Shows whether activation is permanent | No |
slmgr /dli |
Shows basic license details: edition, last five characters of the key, and license status | No |
slmgr /dlv |
Shows detailed license details, including the activation and installation IDs | No |
slmgr /upk |
Uninstalls the current product key | Yes |
slmgr /cpky |
Clears the key from the registry so other programs can’t read it | Yes |
In the slmgr /dli window, look at two lines. License Status: Licensed means Windows is activated. Product Key Channel tells you what kind of license you have: Retail for a key you bought, OEM for one that came with the PC. If it says Volume, the PC uses an organization’s license, so contact that organization’s IT team instead of changing the key.
slmgr shows its results in pop-up boxes. If you want the text inside the Terminal window, which is handy when copying an error, run cscript //nologo C:\Windows\System32\slmgr.vbs /dli instead.
Use the New PowerShell Commands
slmgr is a VBScript file, and Microsoft has deprecated VBScript. In September 2026, Microsoft introduced the OSLicense PowerShell module as the replacement for slmgr in activation tasks and scripts. Windows 11 includes it starting with the September 2026 updates, so install the latest updates in Settings > Windows Update before you try it. Run these in Terminal (Admin), which opens PowerShell by default.

| Task | slmgr | PowerShell (OSLicense) |
|---|---|---|
| Install a product key | slmgr /ipk YOUR-KEY |
Invoke-OSLicense -InstallProductKey 'YOUR-KEY' |
| Activate online | slmgr /ato |
Invoke-OSLicense -ActivateOnline |
| View license details | slmgr /dli |
Get-OSLicenseInfo |
| Remove the product key | slmgr /upk |
Invoke-OSLicense -UninstallProductKey |
If PowerShell says it doesn’t recognize Get-OSLicenseInfo, the PC doesn’t have the update with the module yet; use slmgr for now. slmgr keeps working during the transition. Microsoft explains the change in Keep Windows activation automation working with PowerShell and advises checking the module’s documentation before you rely on it in scripts.
Activate in Settings Instead
The Settings app does the same job without commands, and it’s the better choice if you’re moving from Home to Pro, because entering a Pro key there upgrades the edition.
- Open Settings > System > Activation.
- Select Change next to Change product key, and select Yes if Windows asks for permission.
- Enter the 25-character key and select Next, then Activate.
The Activation state line then reads Active. For more on digital licenses and linking one to your Microsoft account, see how to activate Windows 11.
Find the Product Key Built Into Your PC
Many PCs that came with Windows have an OEM key stored in the firmware. To see it, run this in Terminal:
(Get-CimInstance -Query "select * from SoftwareLicensingService").OA3xOriginalProductKey
If a key appears, it’s the one that shipped with the PC, and Windows normally applies it on its own. If nothing appears, your PC probably uses a digital license or a key you bought separately. The older wmic version of this command no longer works: Microsoft’s deprecated features list says WMIC was removed from Windows 11, version 24H2 and later.
For the other places a key can be stored, including purchase emails and the box, see how to find your Windows 11 product key.
Troubleshooting
Note the error code in the slmgr window, then match it below. Microsoft’s activation error help covers codes not listed here.
- 0xC004F025 or “Access denied”: the window isn’t elevated. Close it and reopen Terminal with Terminal (Admin).
- 0xC004F050 or 0xC004F034: the key isn’t valid for this copy of Windows. Check for typos (B and 8, O and 0 are easy to swap) and confirm the key matches your edition. A Pro key won’t install on Home with slmgr; use the Settings method to upgrade.
- 0xC004C003 or 0xC004C008: Microsoft has seen the key on other PCs, or on more devices than its license allows. Contact the seller, or buy a license for this PC from Settings > System > Activation.
- 0x803F7001: Windows couldn’t find a valid license. Enter a key with
slmgr /ipkor in Settings. - 0x8007232B or 0xC004F074: usually an Enterprise key on Home or Pro, or a work PC that can’t reach its organization’s network. Use a key that matches your edition, or ask your IT team.
- “Input Error: Can not find script file” or nothing happens: VBScript may be turned off on that PC. Check Settings > System > Optional features for VBSCRIPT, or use the PowerShell commands above.
- No internet on the PC: Microsoft’s offline activation steps use an installation ID and a confirmation ID from Microsoft instead.
Run the Activation troubleshooter
While Windows isn’t activated, Settings > System > Activation shows a Troubleshoot button. You need to be signed in as an administrator. It can fix edition mismatches and reactivate a digital license after a hardware change, such as a new motherboard: choose I changed hardware on this device recently, sign in with the Microsoft account linked to the license, select the PC, and select Activate. Microsoft’s activation troubleshooter guide lists the cases it handles.
Remove a Product Key
Moving a retail license to another computer, or selling the PC? Remove the key first. Warning: after the restart, Windows on this PC is no longer activated until you add another key.
- In Terminal (Admin), type
slmgr /upkand press Enter. The box says the key was uninstalled. - Type
slmgr /cpkyand press Enter to clear the key from the registry. - Restart the PC.
A Warning About Activation Scripts
Some websites share commands that point Windows at a third-party activation server, or scripts that “activate” Windows without a purchased key. That isn’t legitimate activation. It violates Microsoft’s license terms, can stop working at any time, and often asks you to turn off security protection, which exposes your PC to malware. Only use keys you bought or received from your school or employer. See legal ways to get Windows 11 without buying a key.
Frequently Asked Questions
Why does slmgr /ato fail?
The common causes are a key for a different edition, no internet connection, a window that isn’t running as administrator, or a key already used on another PC. The error box shows a code; match it in the troubleshooting list above. While Windows isn’t activated, the Troubleshoot button in Settings > System > Activation can also fix common problems.
Do I need to activate if I have a digital license?
No. Windows activates automatically once it’s online. Check Settings > System > Activation first, or see other ways to activate Windows 11.
Can I use Command Prompt instead of Terminal?
Yes. Search for Command Prompt, right-click it, and select Run as administrator. The slmgr commands are the same. The OSLicense commands need PowerShell, which is the default in Terminal.
What happens if I never activate Windows 11?
Windows keeps running and installing updates, but you’ll see “Activate Windows” reminders, and personalization settings such as wallpaper and colors stay locked until you activate.
Can I move my product key to another PC?
A retail key you bought separately can usually move to a new PC once you remove it from the old one. A key that came preinstalled by the manufacturer (OEM) is tied to that PC. The license terms that came with your copy of Windows decide this.
Will slmgr stop working?
Eventually. Microsoft plans to turn VBScript off by default in a later phase and then remove it, at which point slmgr won’t run. Until then, slmgr keeps working, and updated PCs can use the PowerShell commands too.

Matthew Burleigh is the founder, head writer, and editor of Solve Your Tech, which he launched in 2012. He has written technology tutorials since 2008 and worked in IT since 2003, including small-business support, IT management, and consulting. He holds Bachelor’s and Master’s degrees in Computer Science from Arizona State University.
Matthew writes practical guides for Windows, iPhone and iPad, Microsoft Office, Outlook, Google apps, and Android. Solve Your Tech’s guides are checked step by step against the device or app maker’s own documentation and tested on his own devices whenever he has the hardware or software, with clear steps, sources, and update dates.
Read more about Matthew and how Solve Your Tech writes and updates its guides, or report a correction.