A simple PowerShell script to read the Windows product key stored on the system.
This repository provides a PowerShell script that reads the locally stored Windows 10/11 product key directly from the Registry.
It is lightweight, safe, and requires no additional software.
- Description
- Download
- Requirements
- Installation
- Usage
- Common Errors & Solutions
- FAQ
- Security Notes
- License
This script reads the Windows product key from the Registry and outputs it directly to the PowerShell console.
It does not change any system settings and does not write anything to the Registry.
Typical use cases:
- Documenting the product key
- Backing it up before a reinstall
- Verifying OEM/device transfers
File in this repository:
read_win11_product_key.ps1
- Windows 10 or Windows 11
- PowerShell (minimum version 5, default on Windows)
No installation required.
Just download the file and save it locally.
- Open PowerShell
- Change to the folder where the script is located:
cd C:\Users\<USERNAME>\DownloadsRun the script:
.\read_win11_product_key.ps1If the system allows script execution, the product key will be displayed.
Because Windows PowerShell restricts scripts for security reasons, downloaded scripts are often blocked. Below are common errors and how to resolve them.
Example message:
The file ... cannot be loaded because running scripts is disabled on this system.
Set-ExecutionPolicy RemoteSigned -Scope CurrentUserThen run again:
.\read_win11_product_key.ps1Example message:
The file ... is not digitally signed. You cannot run this script on the current system.
Set-ExecutionPolicy Unrestricted -Scope CurrentUserSet-ExecutionPolicy Bypass -Scope CurrentUserCause: Windows may block downloaded files by setting the Zone.Identifier.
Unblock-File .\read_win11_product_key.ps1Set-ExecutionPolicy Bypass -Scope CurrentUserUsing Bypass removes security prompts. Only use it if you trust the scripts.
Does the script work with OEM keys? Yes — both OEM and retail keys are read correctly.
Does the script change anything on the system? No — it only reads Registry values.
Can it read cloud-/Microsoft-account keys? No. Those are not stored on the device.
Do I need admin rights? Usually no. If the Registry is restricted, run PowerShell as Administrator.
The script itself is read-only and safe.
Changing the ExecutionPolicy can reduce system security.
You can restore the default policy at any time:
Set-ExecutionPolicy Restricted -Scope CurrentUserThis project is released under the MIT License. Free to use, including commercially.