Option 1: run command prompt as admin. Enter this command:
wmic path softwarelicensingservice get OA3xOriginalProductKey
Option 2: Run PowerShell as admin. Enter this PowerShell command:
(Get-WmiObject -query ‘select * from SoftwareLicensingService’).OA3xOriginalProductKey
Option 3: Use Powershell script
- Open Notepad
- Copy and paste the following text into the notepad window
function Get-WindowsKey {## function to retrieve the Windows Product Key from any PC## by Nedim Mehicparam ($targets = ".")$hklm = 2147483650$regPath = "Software\Microsoft\Windows NT\CurrentVersion"$regValue = "DigitalProductId"Foreach ($target in $targets) {$productKey = $null$win32os = $null$wmi = [WMIClass]"\\$target\root\default:stdRegProv"$data = $wmi.GetBinaryValue($hklm,$regPath,$regValue)$binArray = ($data.uValue)[52..66]$charsArray = "B","C","D","F","G","H","J","K","M","P","Q","R","T","V","W","X","Y","2","3","4","6","7","8","9"## decrypt base24encoded binary dataFor ($i = 24; $i -ge 0; $i--) {$k = 0For ($j = 14; $j -ge 0; $j--) {$k = $k * 256-bxor $binArray[$j]$binArray[$j] = [math]::truncate($k / 24)$k = $k % 24}$productKey = $charsArray[$k] + $productKeyIf (($i % 5-eq 0) -and ($i -ne 0)) {$productKey = "-"+ $productKey}}$win32os = Get-WmiObject Win32_OperatingSystem -computer $target$obj = New-Object Object$obj | Add-Member Noteproperty Computer -value $target$obj | Add-Member Noteproperty Caption -value $win32os.Caption$obj | Add-Member Noteproperty CSDVersion -value $win32os.CSDVersion$obj | Add-Member Noteproperty OSArch -value $win32os.OSArchitecture$obj | Add-Member Noteproperty BuildNumber -value $win32os.BuildNumber$obj | Add-Member Noteproperty RegisteredTo -value $win32os.RegisteredUser$obj | Add-Member Noteproperty ProductID -value $win32os.SerialNumber$obj | Add-Member Noteproperty ProductKey -value $productkey$obj}}
- Save the file with the .ps1 extension on C:\, For Example KeyFinder.ps1
- Run Powershell as admin and type in
Set-ExecutionPolicy RemoteSigned
- Next run this command
Import-Module C:\Keyfinder.ps1; Get-WindowsKey
It displays Product key.
Please view this step by step video: