in reply to Retrieving Microsoft licence keys from your computer

This will decode the licence keys from your registry for Windows and Office

Doesn't work for me on Windows Vista 64 - sub decodekey returns BBBBB-BBBBB-BBBBB-BBBBB-BBBBB, though I was hoping to see my Windows product key.

Same thing with the other script referred to by Burak.

Mind you, some of the Win32API::Registry and Win32::TieRegistry tests failed (which I haven't investigated). Maybe that's part of the problem.
Have you successfully run that code on Vista ?

Cheers,
Rob

UPDATE: Probably should provide the complete code I ran:
use strict; use Win32::TieRegistry; print decodekey(qq!HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT +\\CurrentVersion\\DigitalProductId!), "\n"; sub decodekey { my @digits = ('B','C','D','F','G','H','J','K','M','P','Q','R','T','V +','W','X','Y','2','3','4','6','7','8','9'); return "No key found\n" if ($_[0] eq ""); my @id = split(/,/,shift); my $key=""; for (my $i=28; $i>=0; $i--) { if (($i+1)%6) { my $ac=0; for (my $j=66; $j>=52; $j--) { $ac<<=8; $ac+=hex $id[$j]; $id[$j]=sprintf("%x",($ac/24)&255); $ac%=24; } $key=$digits[$ac].$key; } else { $key='-'.$key; } } return $key; }
UPDATE: Don't worry - my script is obviously crap. No warnings, doesn't actually make any use of Win32::TieRegistry ... and I don't feel disposed to fixing it.