Finding your Windows Product Key


I recently purchased an Azulle Byte3 for use as my media server. I found the internal SSD that it came with was not large enough for my needs, so I purchased an M.2 which I want to use as the boot drive.

But that means installing Windows 10 on the M.2.

For that I need the Windows Product Key.

But the Byte3 does not have a sticker or other paper indicating what the product key is. So I had to search around for how to find it. The answer, it turns out, is to run the following command in PowerShell:

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

That method works for machines where it key is embedded in the UEFI firmware.

If the key is stored in the Windows registry, save the following as a .vbs file and execute it by double-clicking the file:

Set WshShell = CreateObject("WScript.Shell")
MsgBox ConvertToKey(WshShell.RegRead(_
"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion"&_
"\DigitalProductId"))
Function ConvertToKey(Key)
Const KeyOffset = 52
i = 28
Chars = "BCDFGHJKMPQRTVWXY2346789"
Do
Cur = 0
x = 14
Do
Cur = Cur * 256
Cur = Key(x + KeyOffset) + Cur
Key(x + KeyOffset) = (Cur \ 24) And 255
Cur = Cur Mod 24
x = x -1
Loop While x >= 0
i = i -1
KeyOutput = Mid(Chars, Cur + 1, 1) & KeyOutput
If (((29 - i) Mod 6) = 0) And (i <> -1) Then
i = i -1
KeyOutput = "-" & KeyOutput
End If
Loop While i >= 0
ConvertToKey = KeyOutput
End Function

This site is the source of the above command and code, and covers some other methods that can be used in other circumstances.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s