To find your Windows 11 product key (serial number) using PowerShell, open PowerShell as Administrator and run a specific WMI command. This retrieves the embedded OEM key stored in your device’s UEFI firmware—no third-party tools needed, and it’s safe and official. Note: This only works for retail or OEM-activated systems where the key is physically embedded; volume-licensed or boxed keys may not be retrievable this way.
What You’ll Need
- A Windows 11 device (version 21H2 or later recommended)
- Administrator rights on the device
- Basic familiarity with PowerShell (no coding required)
Step-by-Step
- Press Windows + S to open the search bar. Type
PowerShell. - In the search results, right-click on Windows PowerShell (or PowerShell in newer installs) and select Run as administrator. If prompted by User Account Control, click Yes to confirm.
- At the PowerShell prompt (which appears as
PS C:\Users\[YourName]), paste or type the following command exactly:Get-WmiObject -Query 'SELECT SerialNumber FROM Win32_BIOS' - Press Enter. The output will display a line like
SerialNumber : ABC123-DEFGH-12345-XYZ. This is your Windows product key (or at least the BIOS-embedded portion used for activation). - If the above returns blank or an error, try this alternative command:
(Get-WmiObject -Query 'SELECT * FROM SoftwareLicensingService').OA3xOriginalProductKey - Press Enter. If successful, the full product key will appear. If the key is not embedded (e.g., for some OEMs or custom builds), it may return blank or
NULL.
Common Mistakes
- Running PowerShell without administrator rights—this causes permission errors or empty results.
- Typos in the command, especially missing quotes, incorrect capitalization, or using curly quotes (e.g., ‘ instead of '). PowerShell is case-insensitive, but syntax must be exact.
- Assuming all systems store the key in the BIOS: many modern OEM devices embed it in ACPI tables instead, so the first command may fail while the second succeeds.
- Confusing the BIOS serial number (a hardware identifier) with the Windows product key. The latter is what the commands above retrieve; the former is unrelated to activation.
- Expecting the key for Windows 11 Pro or Enterprise on home devices—some editions don’t store the key locally if activated via digital entitlement or Microsoft account.
Tips
- Copy the key immediately after it appears—PowerShell history doesn’t retain output by default. You can pipe the result to
clip(e.g.,... | clip) to copy it to the clipboard. - For systems with multiple OS installations (dual-boot), this only works on the currently booted Windows 11 instance.
- Some OEMs (e.g., Dell, HP, Lenovo) provide their own tools to retrieve the key, but PowerShell is the most universal built-in method.
- Don’t mistake the
Win32_OperatingSystemserial for the product key—it’s just an internal ID (like WindowsBuild), not the activation key. - After retrieving the key, avoid sharing it publicly. While embedded keys are tied to hardware, they can still be misused if copied.
Troubleshooting
If the commands return no key or an error, follow these steps:
- Check PowerShell version: Run
$PSVersionTable.PSVersion. PowerShell 5.1 (built-in with Windows 11) works fine. If you’re using PowerShell 7+, ensure you’re running the Windows-compatible version (run as Administrator). - Verify WMI service: Press Windows + R, type
services.msc, and confirm Windows Management Instrumentation (WMI) is running. If not, right-click it and select Start. - Run as Administrator again: Even if you think you did, try closing PowerShell and relaunching it with elevated rights. Some users click the user account name instead of “Run as administrator” in the Start menu.
- Try the SLS command in a new session: Close PowerShell, reopen as admin, and run
(Get-WmiObject -Class SoftwareLicensingService -Property OA3xOriginalProductKey).OA3xOriginalProductKeyinstead. - Check for digital entitlement: If your device upgraded from Windows 10 with a digital license, the key may not be stored locally. Run
slmgr /dliin an elevated Command Prompt or PowerShell to see activation status. If it says “Windows is activated with a digital license,” the key isn’t retrievable via WMI—your device uses hardware-based activation tied to Microsoft accounts. - Check BIOS/UEFI settings: Restart and enter your device’s UEFI (usually by holding Shift while clicking Restart, then going to Troubleshoot > Advanced Options > UEFI Firmware Settings). Some systems (especially older ones) store the key in a hidden partition or require a recovery key from the manufacturer.
Frequently Asked Questions
Does this work on Windows 11 Home, Pro, and Enterprise?
Yes—provided the device has an embedded OEM key. Most consumer Home and Pro devices do. Enterprise editions often use volume licensing and may not store the key locally.
Can I retrieve the product key if I’ve reinstalled Windows?
Only if the reinstall used the same hardware and the key was embedded in UEFI. If you entered a new key manually or activated with a Microsoft account, the original key may no longer be accessible via PowerShell.
Is the retrieved key the same as the COA sticker on my laptop?
For newer devices (2016+), no—OEMs stopped printing physical stickers and embed the key in firmware. For older devices, the COA sticker key matches what PowerShell retrieves only if activation hasn’t been transferred or reset.
Why does Get-WmiObject say it’s deprecated?
Microsoft recommends Get-CimInstance for newer scripts, but Get-WmiObject still works in Windows 11 and is more widely supported across PowerShell versions. The equivalent command is Get-CimInstance -Query 'SELECT SerialNumber FROM Win32_BIOS'.
What if I need the key for Microsoft 365 or Office?
This method only retrieves the Windows product key. Office keys require a separate process: open any Office app (e.g., Word), go to File > Account, and look under Product Information. Third-party tools are unsafe for Office keys—Microsoft does not provide a built-in PowerShell method.
Can I use this to reinstall Windows without a key?
Yes—if your hardware has an embedded key, the Windows installer will automatically detect and use it during setup. You don’t need to enter a key manually during reinstallation.