Jump to content

markdmac

Member
  • Posts

    1
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United States

About markdmac

Profile Information

  • OS
    Windows 7 x64

markdmac's Achievements

0

Reputation

  1. I found this forum while trying to resolve an issue with my own VBScript that uses the same GetKey function listed in the source code of this tool. I have found that this function does not work on x64 systems. In fact you can't use VBScript to read the DigitalProductID on an x64 system. I switched to using WMI to get the OS.SerialNumber and that works great, however when I pass this information on to the function it errors out. I am wondering if anyone knows why that would be the case. The function works fine on x86 systems and I don't understand why the conversion would no longer work. In testing the above tool I have found it too does not display the original CD Key as reported. Anyone have any ideas? Here is my vbscript: '========================================================================== ' NAME: GetCDKeyandSerialNumber.vbs '========================================================================== Set WshShell = CreateObject("wscript.Shell") Set env = WshShell.environment("Process") strComputer = env.Item("Computername") Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48) For Each objItem in colItems report = report & "Original CD Key:"& GetKey(objItem.SerialNumber) & vbCrLf report = report & "SerialNumber: " & objItem.SerialNumber & vbCrLf Next MsgBox report Function GetKey(rpk) Const rpkOffset=52:i=28 szPossibleChars="BCDFGHJKMPQRTVWXY2346789" Do 'Rep1 dwAccumulator=0 : j=14 Do dwAccumulator=dwAccumulator*256 dwAccumulator=rpk(j+rpkOffset)+dwAccumulator rpk(j+rpkOffset)=(dwAccumulator\24) and 255 dwAccumulator=dwAccumulator Mod 24 j=j-1 Loop While j>=0 i=i-1 : szProductKey=mid(szPossibleChars,dwAccumulator+1,1)&szProductKey If (((29-i) Mod 6)=0) and (i<>-1) then i=i-1 : szProductKey="-"&szProductKey End If Loop While i>=0 'Goto Rep1 GetKey=szProductKey End Function
×
×
  • Create New...