How to retrieve Windows software license keys

Difficulty
Intermediate
Tested on
Windows 11 Pro - Build 23H2
You will need
Administrative access, Command Prompt, PowerShell

Step by step

  1. 30 sec

    Launch Command Prompt with elevated privileges

    Press the Windows key and type 'cmd'. Right-click the Command Prompt result and select Run as administrator. Confirm the User Account Control prompt to gain full system access.

    Note: Elevated privileges are required to access protected system registry hives.
  2. 1 min

    Extract the Windows OS product key via WMI

    Within the Command Prompt window, type the following command: wmic path softwarelicensingservice get OA3xOriginalProductKey. Press Enter to execute. The system will display your OEM-embedded Windows license key directly below the command.

    Note: This command retrieves the key stored in the motherboard UEFI/BIOS.
  3. 1 min

    Prepare PowerShell for registry key extraction

    Open the Start menu, type 'PowerShell', right-click the application, and select Run as administrator. If your execution policy blocks scripts, run 'Set-ExecutionPolicy RemoteSigned' and confirm with 'Y' to allow local script execution.

    Note: Always revert the execution policy to 'Restricted' after extracting your keys for security.
  4. 2 min

    Execute a registry query script for software keys

    Paste the following script into the PowerShell window: (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform').BackupProductKeyDefault. Press Enter to view the stored license string.

    Note: This specifically targets the software protection registry hive used by many Microsoft-licensed products.
  5. 1 min

    Check the Windows Registry Editor manually

    Press Win + R, type 'regedit', and click OK. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion. Inspect the 'DigitalProductId' entry for alphanumeric strings that signify a license key.

    Note: The data is stored in binary format; complex keys may require third-party decryption utilities to read.