Dim SS= InputBox ("the current Windows system serial number is:","Windows serial number", GETWINDOWSSN) Wscript.Quit'get the current Windows serial number functionFunction getwindowssn () Const HKEY_LOCAL_MACHINE= &H80000002 strKeyPath="SOFTWARE\Microsoft\Windows NT\CurrentVersion"strValueName="DigitalProductID"StrComputer="."Dim ivalues () Set oreg= GetObject ("winmgmts:{impersonationlevel=impersonate}!\\"& StrComputer &"\root\default:StdRegProv") Oreg.getbinaryvalue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, ivalues Dim arrdpid arrdpid=Array () for I= theTo theReDim Preserve arrdpid (UBound (arrdpid)+1) Arrdpid (UBound (arrdpid) )=ivalues (i) Next'<---------------Create An array to hold the valid characters for a Microsoft Product Key------------------------ -Dim arrchars arrchars= Array ("B","C","D","F","G","H","J","K","M","P","Q","R","T","V","W","X","Y","2","3","4","6","7","8","9") '<---------------the clever bit!!! (Decrypt the BASE24 encoded binary data)-------------------------->For i = -To0Step-1k=0For J= -To0Step-1k= k * theXor Arrdpid (j) Arrdpid (j)= Int (k/ -) K= k Mod -Next Strproductkey= Arrchars (k) &Strproductkey'<-------Add the "-" between the groups of 5 Char-------->If I Mod5=0And I <>0Then Strproductkey ="-"&Strproductkey Next getwindowssn=strproductkeyend Function
Windows.vbs Universal
Get the installation serial number for the current Windows