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.

In reply to Re: Retrieving Microsoft licence keys from your computer by syphilis
in thread Retrieving Microsoft licence keys from your computer by lilphil

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.