☕ Buy a Coffee
Home / Windows & SysAdmin

How to Find Your Windows Product Key via Command Prompt

Extract your OEM or retail Windows license key in under 5 seconds using built-in command line and PowerShell WMI queries.

Sachin Siju
Sachin Siju
Lead Systems Engineer & Tech Blogger
Jul 07, 2026 3 min read
How to Find Your Windows Product Key via Command Prompt

What This Command Actually Retrieves

Since Windows 8, OEM manufacturers embed the product key directly in the motherboard's UEFI firmware (in an ACPI table called MSDM) rather than printing it on a sticker. Windows reads that embedded key automatically during installation, which is why a factory-installed copy of Windows activates itself with no key entry required. A single WMI query can pull that embedded key back out, which is useful if you're reinstalling Windows from scratch and need the key on hand, or just archiving it before you get rid of a machine.

What this won't give you: if your PC originally shipped with an older Windows version and was upgraded via the free Windows 10/11 upgrade path, or if it's activated through a Microsoft account digital license rather than a traditional product key, there may be no embedded key to retrieve at all — the license is tied to your Microsoft account and hardware ID on Microsoft's activation servers instead. In that case this command returns nothing, and that's expected, not a failure.

Method 1: Command Prompt (wmic)

Open Command Prompt — Start menu, type cmd, and it doesn't need to be run as administrator for this particular query. Run:

wmic path softwarelicensingservice get OA3xOriginalProductKey

If a key is embedded in firmware, it prints directly under the header line in the standard 5x5 format (XXXXX-XXXXX-XXXXX-XXXXX-XXXXX).

Heads up on newer Windows builds: Microsoft has been deprecating wmic since Windows 10 21H1 and it's removed by default starting with some Windows 11 24H2 builds. If the command above returns "not recognized," use the PowerShell method below instead — it queries the exact same underlying data.

Method 2: PowerShell (Works Everywhere wmic Doesn't)

Open PowerShell (Start menu, type powershell) and run:

(Get-CimInstance -Query 'select * from SoftwareLicensingService').OA3xOriginalProductKey

This calls the same WMI class (SoftwareLicensingService) that wmic was querying, just through the modern CIM cmdlets that replace it. It works identically on Windows 10 and Windows 11 and isn't affected by the wmic deprecation.

Checking Your Current Activation Status Instead

If what you actually need is confirmation that Windows is activated — rather than the raw key itself — slmgr (Software Licensing Manager) is the more direct tool. Run from an elevated Command Prompt:

slmgr /xpr

This pops up a dialog telling you whether Windows is permanently activated or when a subscription/trial-based activation expires. For a fuller license report including the partial product key currently in use (Microsoft masks most of it for security, showing only the last 5 characters):

slmgr /dlv

Why the Full Key Sometimes Doesn't Match What's Installed

If you've ever upgraded your Windows edition (Home to Pro, for instance) using a separate product key, the OEM key embedded in firmware is still the original key the machine shipped with — the WMI query above always returns that original OA3 key, not whatever key you entered later during an edition upgrade. In that case, the currently active license is tracked separately by Microsoft's activation servers against your hardware ID, and there's no local command that extracts a key you never manually entered in the first place, since digital licenses by design don't store a retrievable literal key on the machine.

Saving the Key Somewhere Useful

If you're about to wipe a drive and want the key on record, don't rely on a screenshot alone — pipe it straight into a text file so it survives a reboot into a recovery environment where you might not have your screenshot handy:

(Get-CimInstance -Query 'select * from SoftwareLicensingService').OA3xOriginalProductKey | Out-File "$env:USERPROFILE\Desktop\product-key.txt"

Store that file somewhere other than the machine you're about to reinstall — a cloud drive, a USB stick, or password manager note — since the whole point is having it available after the local disk is gone.

Featured Infrastructure Partner

Deploy on High-Performance Hostinger Cloud

Get up to 75% OFF + free domain & SSL. Powering xube.me's sub-second response times.

Claim Discount ↗

Discussion & Insights

Related Technical Essays