Jump to content

CDKey?


purg99

Recommended Posts

I have a two part question

1.

Ive been playing around how to change windows CD key after an unattended install. Im able to display PID's and change the key but unable to find a way to display what key is already on a system.

Display PID

strComputer = "." 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery( _
   "SELECT * FROM Win32_WindowsProductActivation",,48)
For Each objItem in colItems
   Wscript.Echo "ProductID: " & objItem.ProductID
Next

Change key

for each Obj in GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf ("win32_WindowsProductActivation")
  result = Obj.SetProductKey (VOL_PROD_KEY)
  if err <> 0 then
     Err.Clear
  end if
Next

I DONT WANT TO USE DOWNLOADABLE TOOLS LIKE MAGICALJELLYBEAN

I want to know a way to display the active CDKey on a system with vbs or other tools preloaded on a standard xp build.

------------------

2. The long shot

I also want to know a formular to generate one of the many keys from a pid

how does a pid xxxxx-640-1234567-yyyyy convert to the key xxxx-xxxx-xxxx-xxxx-xxxx

Edited by purg99
Link to comment
Share on other sites


Why would this be a problem it's no different than "How do i get my Cd key, i forgot it" type questions.

If your not in a rush I have a vb script which can decode it but I won't be able to post it until monday.

If you want to try it yourself the cd key is in HKLM\software\microsoft\windows nt\currentversion\digitalproductid

it is reverse base24 encoded in bytes 52 through 66, which when decoded will give you 25 characters of the cd key. Possible key characters are B,C,D,F,G,H,J,K,M,P,Q,R,T,V,W,Z,Y,2,3,4,6,7,8,9.

Good Luck.

Check back monday.

Also check out KeyDecoder its and exe I wrote for the MSFN community, it's still in testing but should be finished soon.

And as you can see the ProductID itself does not initself translate to th cd key, the digital encoding of it and other stuff does.

Link to comment
Share on other sites

1. GetXPKey.vbs

code:

--------------------------------------------------------------------------------

Set WshShell = WScript.CreateObject("WScript.Shell")

strDigitalProductId="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"

strXPKey=GetKey(WshShell.RegRead(strDigitalProductId))

MsgBox "WinXP:"&strXPKey&chr(13)

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

------------------------

Link to comment
Share on other sites

It's his third post.  One was about changing icons, cool.  The other was about cd-keys also. Mixed keys

Now he wants a script capable of pulling cd-keys of machines.

DL

DL I sure hope your NOT well known on this forum as all I can see is spam. WTF has this got to do with anything. If I dont want to post about what I had for dinner but ask real questions please dont post your kind of junk but PM me. Thank you your comments are not welcome or helpful TO ANYONE.

it is reverse base24 encoded in bytes 52 through 66, which when decoded will give you 25 characters of the cd key.

Thank you for the information, very handy.

strXPKey=GetKey(WshShell.RegRead(strDigitalProductId))

MsgBox "WinXP:"&strXPKey&chr(13)

Excellent, couldnt have asked for more thank you :) maybe DL will even find this helpful and learn something :P

Edited by purg99
Link to comment
Share on other sites

DL I sure hope your NOT well known on this forum as all I can see is spam. WTF has this got to do with anything. If I dont want to post about what I had for dinner but ask real questions please dont post your kind of junk but PM me. Thank you your comments are not welcome or helpful TO ANYONE.

Dude this is a forum. Not a legal lession. People have to right to be themselves and be off tone if the mood stikes them. Leave that type of thing to the mods. Also downright chewing someone out is wrong. Please don't take your misplaced aggression out on the members. We are people too.

Edited by Hatefulsorrow
Link to comment
Share on other sites

DL I sure hope your NOT well known on this forum as all I can see is spam. WTF has this got to do with anything. If I dont want to post about what I had for dinner but ask real questions please dont post your kind of junk but PM me. Thank you your comments are not welcome or helpful TO ANYONE.

Dude this is a forum. Not a legal lession. People have to right to be themselves and be off tone if the mood stikes them. Leave that type of thing to the mods. Also downright chewing someone out is wrong. Please don't take your misplaced aggression out on the members. We are people too.

Yep nothing legal stated. From this I too have the right to be themselves and be off tone if the mood stikes them.

Thank you and have a good day as ive taken all I need

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...