How to Find Your Windows Product Key Using Command Prompt or PowerShell

Easily retrieve your Windows product key with built-in tools, whether you have a retail or OEM license

How to Find Your Windows Product Key Using Command Prompt or PowerShell

Locating your Windows product key is essential for various reasons, such as reinstalling your operating system or transferring your license. Fortunately, Windows provides built-in tools that make this process straightforward. This guide will show you how to find your Windows product key using Command Prompt and PowerShell, two powerful command-line interfaces in Windows.

Using Command Prompt to Find Your Windows Product Key

The Command Prompt method is quick and works for both retail and OEM (Original Equipment Manufacturer) licenses. Here’s how to use it:

Step 1: Open the Command Prompt as an administrator. You can do this by right-clicking on the Start button and selecting “Command Prompt (Admin)” or “Windows Terminal (Admin)” from the menu.

Step 2: Once the Command Prompt window opens, copy and paste the following command:

wmic path softwarelicensingservice get OA3xOriginalProductKey

Step 3: Press Enter to execute the command. After a brief moment, your 25-character Windows product key will be displayed on the screen.

This method retrieves the product key embedded in your system’s BIOS or UEFI firmware, making it particularly useful for OEM licenses that come pre-installed on many computers.


Using PowerShell to Retrieve Your Windows Product Key

PowerShell offers an alternative method to find your Windows product key. This approach is equally effective and works across multiple Windows versions, including Windows 11, 10, 8, and 7.

Step 1: Open PowerShell as an administrator. You can do this by right-clicking the Start button and selecting “Windows PowerShell (Admin)” or “Windows Terminal (Admin)” from the menu.

Step 2: In the PowerShell window, copy and paste the following command:

(Get-WmiObject -query 'select * from SoftwareLicensingService').OA3xOriginalProductKey

Step 3: Press Enter to run the command. Your Windows product key will be displayed in the PowerShell window.

This PowerShell method is particularly useful because it works across multiple Windows versions and can retrieve both retail and OEM license keys.

Additional Information About Windows Product Keys

Understanding the nature of your Windows license can help you manage your product key more effectively:

  • Retail licenses are tied to the person who purchased them and can be transferred between devices.
  • OEM licenses are tied to the specific machine they came with and typically cannot be transferred.
  • In Windows 10 and 11, product keys are often encrypted and tied to your Microsoft Account, with the activation status stored in the cloud.

For more detailed information about your Windows license, you can use the following PowerShell command:

Get-CimInstance -query 'select * from SoftwareLicensingService'

This command provides additional details about your Windows license, which can be helpful for troubleshooting activation issues or verifying your license type.


With these methods, you can easily retrieve your Windows product key whenever needed. Remember to keep your product key in a safe place, as it’s crucial for future installations or transfers of your Windows license.