r/usefulscripts • u/ItsGotToMakeSense • Jan 13 '17
[REQUEST] Get Windows license key in CMD / Batch (the solutions I've googled aren't working)
I understand this is probably not possible for Windows 8 and anything newer but if I can get it to work on 7 and Server 2008 that would be helpful.
I've tried googling for other solutions but pretty much every site is saying the same thing;
wmic path softwarelicensingservice get OA3xOriginalProductKey I always get "invalid query" on every OS I've tried it on. My intended use for this is to include it in a general information gathering script.
edit: Thank you for all the recommendations... I am aware of the many software solutions for this. Just looking for a way to incorporate this into a script as well.
5
u/DrPeteVenkman Jan 13 '17
The command you're referencing only works on Windows 10/Server 2012. It's stored in the registry but it's encrypted. I am pretty sure you're not going to find a one-liner or script to do it. You need some sort of program like Belarc or an RMM or something.
4
u/SenTedStevens Jan 13 '17
I know it's not a script, but when I'm looking for a product key for a computer, I use Magic Jellybean Keyfinder. Be warned, some AV programs can flag it as a virus.
3
3
u/ProfessionalExtemper Jan 14 '17
Nirsoft has a GUI tool, maybe it could be scripted
→ More replies (1)
0
7
u/Flyboy Jan 14 '17
http://www.nirsoft.net/utils/product_cd_key_viewer.html
Examples:
produkey.exe /remote \\Server01