
Step-by-step 2026 guide to activate Windows 11 from CMD and PowerShell using official Microsoft slmgr.vbs commands, GVLK keys, and error fixes.
Last updated: April 2026
If you want to activate Windows 11 with CMD and PowerShell the right way in 2026, this is the most complete official guide you will read this year. Instead of relying on shady scripts or random YouTube tutorials, you will learn how to use Microsoft's own slmgr.vbs commands, the official GVLK (Generic Volume License Key) table published on Microsoft Learn, and the PowerShell equivalents that work on Windows 11 23H2, 24H2, and the upcoming 25H1 builds. Whether you are an IT administrator deploying machines for a small Gulf-based startup, a developer who reinstalled Windows after upgrading hardware, or a curious power user who simply wants to understand what slmgr /ipk actually does behind the scenes, this guide gives you a clean, accurate, and legally honest walkthrough — including a frank section on what is and is not allowed under Microsoft's licensing terms.
To activate Windows 11 from CMD, open Command Prompt as Administrator, run slmgr /ipk <your-25-character-key> to install your product key, then run slmgr /ato to activate online with Microsoft's servers. Verify success with slmgr /xpr. The same flow works in PowerShell. Always use a key that matches your edition (Pro, Home, Enterprise, etc.).
slmgr.vbs (Software Licensing Management Tool) is a Visual Basic script that ships with every modern Windows installation, located at C:\Windows\System32\slmgr.vbs. It is the official command-line interface to the Software Licensing service (sppsvc.exe) that handles all activation, key installation, and license verification on Windows. Microsoft has shipped this tool since Windows Vista, and it remains the supported way to script activation in 2026 — even Microsoft's own deployment documentation on Microsoft Learn references it for KMS, MAK, and Retail key scenarios.
When you run a command like slmgr /ipk, the script communicates with the Software Protection Platform (SPP), which then validates your key against Microsoft's licensing database the next time you call /ato. Because slmgr.vbs writes to system-protected areas of the registry and interacts with a privileged service, every command must be executed from an elevated prompt — a regular user-mode CMD will fail silently or throw error 0x80070005 (access denied).
There are two near-identical entry points: slmgr (which calls cscript.exe slmgr.vbs under the hood and prints output via Windows Script Host dialogs) and cscript slmgr.vbs directly (which prints to the console). For automation and SSH scenarios, prefer cscript //nologo slmgr.vbs so output goes to standard output instead of popping up a dialog box.
slmgr is bundled into all editions of Windows 11 — Home, Pro, Pro for Workstations, Pro Education, Education, Enterprise, Enterprise LTSC 2024, and the IoT variants — and works the same on x64, ARM64, and the Insider builds. The behavior is identical across the 23H2 and 24H2 release channels.
Follow this sequence exactly. Each step assumes you have a valid product key — either a Retail key you purchased, an OEM key tied to your device, or a GVLK from a properly licensed Volume Activation environment.
Step 1 — Open Command Prompt as Administrator. Press the Windows key, type cmd, right-click "Command Prompt", and choose "Run as administrator". Approve the User Account Control prompt. You should see C:\Windows\System32> in the title bar — if you see your user folder, you are not elevated.
Step 2 — Remove any existing key (optional cleanup). If a previous key is installed and you want a clean slate, run slmgr /upk to uninstall the current product key, then slmgr /cpky to scrub it from the registry. Skip this step if you are activating a fresh install for the first time.
Step 3 — Install your product key. Run slmgr /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX, replacing the X's with your actual 25-character key. A success dialog confirms the key was installed. If you see error 0xC004F050, your key is invalid for this edition — double-check that a Pro key is going onto a Pro install, not Home.
Step 4 — Activate online with Microsoft. Run slmgr /ato. This contacts Microsoft's activation servers over HTTPS (port 443). If your firewall blocks outbound HTTPS to activation.sls.microsoft.com, this step will fail with 0x8007232B or 0x8007007B. A successful run shows "Product activated successfully".
Step 5 — Verify activation status. Run slmgr /xpr to see the expiration. For permanently activated Retail and OEM keys, you will see "The machine is permanently activated". For KMS-activated machines (Volume Licensing only), you will see an expiration date 180 days in the future.
Step 6 — Get full license details. Run slmgr /dlv for the verbose license report — it shows your license channel (Retail / OEM / Volume), partial product key, activation ID, and remaining grace period if any. This is the diagnostic command IT pros run before logging support tickets.
If anything fails, jump to the error code table below before re-running. Re-running /ato repeatedly without fixing the underlying cause will not help and may trigger temporary throttling from Microsoft's activation servers.
Below is every commonly used slmgr switch you should know in 2026. These are documented in Microsoft Learn under "Slmgr.vbs options for volume activation".
| Command | What It Does | When to Use |
|---|---|---|
slmgr /ipk <key> | Installs a product key | First step of any activation |
slmgr /ato | Activates Windows online | After installing a Retail or MAK key |
slmgr /dli | Displays brief license info | Quick status check |
slmgr /dlv | Displays detailed license info | Diagnostics, channel verification |
slmgr /xpr | Shows activation expiration date | Confirming KMS renewal or permanent status |
slmgr /upk | Uninstalls the current product key | Before transferring a key to another machine |
slmgr /cpky | Removes the key from the registry | Privacy / preparing image for cloning |
slmgr /rearm | Resets the activation grace timer | Sysprep deployment (max ~3 times per install) |
slmgr /skms <host:port> | Sets a KMS host for activation | Enterprise networks with internal KMS |
slmgr /ckms | Removes KMS host setting | Reverting to public auto-discovery |
slmgr /ato <activation-id> | Activates a specific subscription | Microsoft 365 sub-add-ons |
slmgr /skhc | Enables KMS host caching | Reducing KMS lookups on roaming clients |
For a deeper look at when to apply each one in a real deployment, see our companion guide on the Windows 11 Home vs Pro vs Enterprise comparison, which explains why Enterprise editions need different activation flows.
GVLKs (Generic Volume License Keys) are publicly published by Microsoft for use with Volume Activation environments — meaning a properly licensed organization running a KMS host or using Active Directory-Based Activation. They are not "free Windows" — they only activate when they can reach a legitimate KMS host owned by an organization with a Volume Licensing agreement. The keys themselves are public information.
Below is the current 2026 table from Microsoft Learn (last refreshed April 2026):
| Edition | GVLK Key |
|---|---|
| Windows 11 Pro | W269N-WFGWX-YVC9B-4J6C9-T83GX |
| Windows 11 Pro N | MH37W-N47XK-V7XM9-C7227-GCQG9 |
| Windows 11 Pro for Workstations | NRG8B-VKK3Q-CXVCJ-9G2XF-6Q84J |
| Windows 11 Pro Education | 6TP4R-GNPTD-KYYHQ-7B7DP-J447Y |
| Windows 11 Education | NW6C2-QMPVW-D7KKK-3GKT6-VCFB2 |
| Windows 11 Enterprise | NPPR9-FWDCX-D2C8J-H872K-2YT43 |
| Windows 11 Enterprise N | DPH2V-TTNVB-4X9Q3-TJR4H-KHJW4 |
| Windows 11 Enterprise LTSC 2024 | M7XTQ-FN8P6-TTKYV-9D4CC-J462D |
| Windows IoT Enterprise LTSC 2024 | KBN8V-HFGQ4-MGXVD-347P6-PDQGT |
| Windows 11 Pro Workstations N | 9FNHH-K3HBT-3W4TD-6383H-6XYWF |
To use these legally, your machine must reach a KMS host inside an organization with an active Microsoft Volume Licensing agreement. Pointing a GVLK at a public "free KMS" server you found on Google — like the popular kms.msguides.com — is a clear violation of Microsoft's license terms, even if it technically activates for 180 days.
If you live in PowerShell (and as a Windows 11 admin in 2026, you should), you do not have to leave it just to check activation. The SoftwareLicensingService and SoftwareLicensingProduct WMI/CIM classes give you the same data slmgr /dlv returns, but as objects you can pipe and filter.
To check activation status in PowerShell:
Get-CimInstance -Query "SELECT * FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL" |
Select-Object Name, Description, LicenseStatus, PartialProductKey
LicenseStatus = 1 means activated. 0 is unlicensed, 2 is in grace, 3 is out-of-tolerance grace, 4 is non-genuine, 5 is notification mode.
To install a key from PowerShell:
$key = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"
$service = Get-CimInstance SoftwareLicensingService
Invoke-CimMethod -InputObject $service -MethodName InstallProductKey -Arguments @{ ProductKey = $key }
Invoke-CimMethod -InputObject $service -MethodName RefreshLicenseStatus
The advantage of PowerShell is scripting — you can deploy a key across hundreds of machines via Intune or Invoke-Command to remote sessions, all from a single line. The disadvantage is verbosity. For one-off troubleshooting on a single PC, plain slmgr from CMD is faster.
| Error Code | Meaning | Fix |
|---|---|---|
0xC004C003 | The activation server determined the key is blocked | Stop using this key — likely abused / Volume reseller. Buy a fresh Retail key |
0xC004F050 | Product key invalid for this edition | Verify Pro key on Pro install, Home key on Home, etc. |
0x803F7001 | No product key found — typically after hardware change | Re-link Microsoft account → Activation Troubleshooter |
0xC004E003 | License validation failed | Run sfc /scannow then slmgr /ato again — corrupted SPP files |
0xC004F074 | KMS host could not be contacted | Check DNS for _vlmcs._tcp record, verify KMS host reachable on port 1688 |
0x8007232B | DNS name does not exist (KMS lookup failed) | Set explicit KMS with slmgr /skms <host> |
0x80070005 | Access denied | Re-run CMD/PowerShell as Administrator |
0x8007007B | The filename, directory, or volume label syntax is incorrect | Quote KMS hostname properly, check FQDN |
If you keep hitting 0xC004C003 on a key you purchased recently, the seller almost certainly resold a Volume License key that Microsoft has now revoked — see our cheap genuine Windows 11 Pro key buying guide for how to spot these scams before purchase.
The 24H2 release (now on the LTSC 2024 servicing branch and rolling out via 25H1 General Availability in early 2026) introduced two changes that affect how activation behaves on home networks:
BitLocker is enabled by default on clean installs with a Microsoft account. This does not change activation directly, but it means that if you swap your motherboard before recording the recovery key, you will lose access to the drive — and the new motherboard will trigger a "hardware significantly changed" re-activation. Always export your BitLocker recovery key from aka.ms/myrecoverykey before any hardware change.
SMB signing is required by default. This breaks legacy KMS hosts running on older Windows Server versions (2012 R2 and earlier) when clients try to pull GVLK metadata over SMB. The fix is to either upgrade the KMS host to Server 2019+ or to enable SMB signing exemptions via Group Policy at Computer Configuration > Windows Settings > Security Settings > Local Policies > Security Options > Microsoft network client: Digitally sign communications.
Activation servers now prefer TLS 1.3. If you are activating an old Windows 11 image that was never patched, slmgr /ato may fail with TLS errors. Run Windows Update first, then re-attempt activation.
This section is something every guide should publish but almost none do. Here is an honest 2026 breakdown:
| Method | Cost | Legality | Risk |
|---|---|---|---|
| Retail key from Microsoft Store | $199 (Pro) | 100% legal | None |
| OEM key with new PC | Bundled | 100% legal | None |
| MAK / Volume key under your org's VL agreement | Per agreement | 100% legal | None |
| Authorized Amazon reseller (verified) | $50–120 | Legal if seller has rights | Low — verify reseller |
| Gray-market key sites (Kinguin / G2A / SCDKey) | $5–25 | Murky / often resold Volume keys | High — keys revoked in 6–12 months |
Public KMS server (kms.msguides.com etc.) | Free | Violates Microsoft EULA | Very high — points GVLK at unauthorized host |
| KMSPico-style activator scripts | Free | Illegal + EULA violation | Severe — 30%+ infected with malware per 2025 Avast report |
The practical takeaway: if you are running Windows in a business, on a machine that handles client data, or on your personal device with banking and photos on it, paying $50–199 once is dramatically cheaper than the cost of one ransomware incident from a poisoned activator.
If your watermark keeps coming back after using a sketchy activator, the fix is not another sketchier tool — it is to reinstall cleanly and follow our guide to remove the Activate Windows watermark properly.
The accounts below are illustrative composites based on common scenarios our team has helped users navigate over the past two years. Names are pseudonyms; details have been combined and lightly edited.
Khalid (Riyadh, IT admin at a 40-person engineering firm). Khalid inherited 18 Windows 11 Pro machines that had all been "activated" by a previous freelancer using an external KMS server. Within four months, every single machine fell back to a non-genuine state simultaneously — Microsoft had revoked the underlying Volume key. Khalid migrated the fleet to legitimate Microsoft 365 Business Premium licenses that include Windows 11 Pro entitlement, used slmgr /ipk with the GVLK and pointed the machines to his Azure AD-Based Activation, and resolved the issue in a single afternoon. Total cost: roughly $22 per user per month, and he now has a clean, audit-passable license trail.
Lina (Cairo, freelance developer). Lina rebuilt her workstation, popped in a new motherboard, and her perfectly legitimate Retail Pro key would not reactivate — error 0x803F7001. She had bought the key directly from Microsoft Store two years earlier but had not linked it to her Microsoft account at purchase time. She opened a Microsoft chat support session, provided the original receipt, and an agent reactivated the key over the phone using slui 4. Lesson: always sign in with your Microsoft account on a new install so the digital license follows the account, not just the hardware.
slmgr write command requires elevation. A missing UAC step is the single most common cause of the silent-failure complaint.0xC004F050. Either reinstall to match, or use slmgr /ipk with the correct Pro key.slmgr /rearm as infinite. You get a small, finite number of rearms per installation (typically 3 for Windows 11). Burning them on a working install means you cannot reset later.slmgr /xpr after activation. If you do not verify, you will not notice that a "successful" activation was actually a 180-day KMS lease that quietly expires later.Open CMD as Administrator, run slmgr /ipk YOUR-KEY-HERE to install your product key, then slmgr /ato to activate it online with Microsoft. Confirm with slmgr /xpr. No third-party tools, no scripts, no downloads — just the built-in slmgr.vbs script that ships with every Windows 11 install.
slmgr /ipk only installs the product key into the Software Protection service — it does not contact Microsoft. slmgr /ato then sends an activation request to Microsoft's servers using the installed key. You almost always run them as a pair: install the key first, then activate it. Running /ato without first installing a key produces error 0xC004F014.
Not legitimately. Windows 11 will install and run in a limited "unactivated" state (with the watermark, restricted personalization, and periodic notifications) without a key, but full activation always requires a valid Retail, OEM, MAK, or KMS-eligible GVLK key. Any "activator" that promises otherwise either pirates the OS or installs malware.
KMS activations last 180 days by default and renew automatically every 7 days as long as the client can reach the KMS host. They are not permanent. A Retail or OEM key, by contrast, activates the machine permanently (until significant hardware changes). Anyone selling "lifetime KMS activation" is misrepresenting how the protocol works.
Because slmgr.vbs writes to the Software Protection Platform (SPP) registry hive and interacts with the privileged sppsvc.exe service. Both are protected system resources. Without elevation, every write call fails with 0x80070005 (access denied). Always launch CMD via right-click → "Run as administrator".
It is technically free and may activate your install for 180 days, but it directly violates Microsoft's licensing terms because GVLKs are licensed only for use against KMS hosts owned by organizations with active Volume Licensing agreements. Beyond legality, you are also handing your machine's identity to an anonymous server you cannot vet.
Run slmgr /xpr from an elevated CMD. If you see "The machine is permanently activated" you have a Retail, OEM, or MAK activation. If you see an expiration date roughly 180 days in the future, you are on KMS — that is not permanent, it just renews automatically inside an org network.
The official 2026 GVLK for Windows 11 Pro published on Microsoft Learn is W269N-WFGWX-YVC9B-4J6C9-T83GX. Remember that this key only activates against a properly licensed Volume Activation environment — it is not a "free Pro key" for home users.
Yes. All slmgr switches documented in this guide work identically on Windows 11 24H2 and the early 25H1 builds. Microsoft has not deprecated slmgr.vbs. The only behavior changes in 24H2 affect TLS versions used for activation requests and SMB signing for KMS host communication — both fixed by keeping Windows fully patched.
Activating Windows 11 from CMD or PowerShell is straightforward when you stick to the official tools: slmgr.vbs for one-off work, the SoftwareLicensingService CIM class for scripting, and a legitimately purchased Retail or OEM key (or a properly licensed Volume key inside an org). The temptation to "save money" with public KMS servers and activator scripts is real, but the math almost never works out — a single malware incident or a revoked key six months in costs more than a Microsoft Store license. Bookmark this guide, save the GVLK table for legitimate Volume scenarios, and keep the error code reference handy the next time slmgr /ato complains.
When you are ready to upgrade your editions or shop legitimately, our companion guides cover the cheapest genuine Windows 11 Pro key sources, a deep dive on Windows 11 editions, how to remove the Activate Windows watermark, and the official way to activate Microsoft Office 365 — all written with the same evidence-first approach.
For our own original Windows activation walkthrough that complements this guide with offline scenarios, see the Truescho activate-Windows-offline reference. And if you are a student, our GPA calculator and opportunities database help you make the most of every dollar you do not spend on shady keys.
mahmoud hussein
Writer at Truescho Blog — We provide trusted content about scholarships, study abroad, and immigration.