PowerShell can retrieve the Windows product key embedded in your device’s UEFI firmware, allowing you to reinstall or verify your license without physical access to a sticker. This works only on systems with digital entitlement (Windows 8.1 and later) and requires local administrator rights. No extra tools or downloads are needed—just PowerShell itself.

What You’ll Need

  • A Windows PC running Windows 8.1, Windows 10, or Windows 11
  • Local administrator account access
  • PowerShell (built-in; use Windows PowerShell or PowerShell 7+)

Step-by-Step

  1. Open PowerShell with administrator privileges:
    • Press Windows + S, type PowerShell, then right-click Windows PowerShell (or PowerShell in newer systems).
    • Select Run as administrator.
    • If User Account Control (UAC) prompts appear, click Yes to proceed.
  2. Enter the following command to extract the product key from the BIOS/UEFI firmware:
    Get-WmiObject -Query 'Select * from SoftwareLicensingService' | Select-Object -ExpandProperty OA3xOriginalProductKey
    • Type or paste the full command exactly as shown (case doesn’t matter).
    • Press Enter.
    • The key—typically 25 characters in five groups of five (e.g., XXXXX-XXXXX-XXXXX-XXXXX-XXXXX)—will display on the next line.
  3. Repeat the command if needed to verify consistency:
    • Run the same command a second time in the same session or a new one.
    • The key should match both times. If it differs or fails, see the Troubleshooting section.
  4. Save or record the key securely:
    • Copy the displayed key by highlighting it with your mouse, right-clicking, and selecting Copy (or press Ctrl + C after selecting).
    • Paste it into a secure note or password manager. Avoid saving it in plain text on your desktop.

Common Mistakes

  • Running PowerShell without admin rights: Non-administrative sessions return a blank result or an error. Always confirm the window title shows (Administrator).
  • Using outdated commands: Older guides reference wmic path SoftwareLicensingService get OA3xOriginalProductKey, which may fail on newer systems due to WMI service restrictions. The Get-WmiObject method is more reliable across current Windows versions.
  • Assuming all devices have an embedded key: OEM systems (Dell, HP, Lenovo) with Windows 8+ typically embed keys in firmware. Older pre-installed licenses (e.g., Windows 7) or Volume License keys may not display here.
  • Confusing OEM keys with retail keys: The retrieved key is often an OEM generic key used for activation during imaging. It may not be valid for reactivation on a different PC.

Tips

  • Use Ctrl + Shift + Enter in the Start menu to quickly open PowerShell as admin.
  • For PowerShell 7+ users: Run Get-WmiObject in the *Windows PowerShell* window instead, since Get-WmiObject is deprecated in newer versions and may not be available.
  • After retrieving the key, verify activation status by opening Command Prompt as admin and running slmgr /dli for full license details.
  • Back up your key using Microsoft’s digital license recovery tool if you upgraded through Windows 10’s free offer—though this is rare now, it’s useful for legacy systems.

Troubleshooting

  • No key displays (blank output): This means your device does not store the key in firmware. Try these steps:
    • Check if your PC is an OEM model (e.g., Dell, HP). Retail or self-built PCs often lack embedded keys.
    • Run slmgr /dli in Command Prompt (as admin) to see the current activation status and partial key (last 5 characters).
    • Look for a sticker on the PC case or battery compartment (for laptops) if it’s an older device.
  • Error: “The term ‘Get-WmiObject’ is not recognized”:
    • You’re likely using PowerShell 7+ in a core environment where legacy cmdlets are disabled. Switch to Windows PowerShell (v5.1), which includes WMI support.
    • Alternatively, use this replacement command (requires PowerShell 3+):
      (Get-WmiObject -query 'select * from SoftwareLicensingService').OA3xOriginalProductKey
  • “Access is denied” or permission errors:
    • Confirm you’re logged in with an administrator account (not a standard user).
    • Run PowerShell again and double-check the UAC prompt showed Yes.
    • Ensure Windows Management Instrumentation (WMI) service is running: Press Windows + R, type services.msc, locate Windows Management Instrumentation, and verify its status is Running.
  • Key shows but activation fails later:
    • OEM keys are tied to the original motherboard. If you replace hardware (especially the motherboard), activation may fail even with the correct key.
    • For reinstallation, use the Reset this PC option in Settings > Recovery, which preserves your digital entitlement automatically.
  • Command runs but returns garbage characters:
    • This is rare and usually indicates firmware corruption. Try running sfc /scannow in Command Prompt (as admin) to repair system files, then re-run the PowerShell command.

Frequently Asked Questions

Does this work on Windows 7?

Yes, but only if the system was upgraded to Windows 10 or 11 and uses digital entitlement. Pure Windows 7 OEM installs often lack firmware-stored keys and will return blank.

Can I use this key to activate a different PC?

No. OEM keys are hardware-bound. Retail keys tied to a Microsoft account can transfer, but the PowerShell method rarely retrieves those—only firmware keys, which are non-transferable.

Is the retrieved key the same as the one on the COA sticker?

On newer OEM systems, yes—the firmware key matches the sticker. On older systems, the sticker may contain a generic OEM key used during manufacturing, while the firmware holds a unique activation key.

Why does the key sometimes show as all zeros?

If your system uses a Volume License (common in businesses) or was activated via KMS, no consumer product key is stored. The system activates via network-based licensing, not a static key.

Can I retrieve the key remotely using PowerShell?

Not reliably. Get-WmiObject requires local access and elevated privileges. Remote execution needs additional configuration (e.g., WinRM enabled, firewall exceptions), and even then, firmware keys are often inaccessible over the network for security reasons.

Does this method violate Microsoft’s licensing terms?

No. Retrieving your own system’s embedded key for personal use is permitted. Distributing or reusing it on unauthorized devices violates the terms, but checking your own license is standard practice.