Windows (and Office?) product key finder
Posted: 12 Apr 2021 15:36
There are scripts published on the web that display Windows (XP and up) product keys (XXXXX-XXXXX-XXXXX-XXXXX-XXXXX). On Microsoft's site you can find this .vbs script (I replaced msgbox with wscript.echo). This script displays Windows 10 key for your computer:
I might try and convert it to batch. I am sure some of you would be more efficient (Aacini, aGerman...). This is not a competition... (yet).
It would be great to have a .cmd that would display product key for Windows and Office from XP and up (have to search for info how to distinguish this).
Saso
Did some search:
https://answers.microsoft.com/en-us/win ... 3db2f6ae11
https://answers.microsoft.com/en-us/win ... h=1&page=4:
Note mentioned above:
https://answers.microsoft.com/en-us/win ... 86f381da3e
Code: Select all
Set WshShell = CreateObject("WScript.Shell")
wscript.echo 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
It would be great to have a .cmd that would display product key for Windows and Office from XP and up (have to search for info how to distinguish this).
Saso
Did some search:
https://answers.microsoft.com/en-us/win ... 3db2f6ae11
https://answers.microsoft.com/en-us/win ... h=1&page=4:
Note mentioned above:
Code: Select all
You may need to change the code to DigitalProductId4 if it is 64 bits, that's what I had to do.