Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cant locate serial # 2

Status
Not open for further replies.

NEXCOMPAC

IS-IT--Management
Jul 20, 2005
59
US
I have a workstation that runs windows xp pro on a server 2003 enviornment. Its having problems and I want to reinstall the os from scratch. I have the disk but cant seem to locate the serial number. Is there a way to find out the current serial number and reuse it?

 
Do a Google search for the following programs...

keyfinder.exe
rockxp3.exe
cd-keyreader.exe
 
If you go the the control panel and click System. On the first page you should see the Registered to: section.

The 3rd line should be the registration code (i think).
 
Yes, WMI can do this.

Code:
'==========================================================================
' NAME: GetCDKeyandSerialNumber.vbs
'
' AUTHOR: Mark D. MacLachlan , The Spider's Parlor
' URL: [URL unfurl="true"]http://www.thespidersparlor.com[/URL]
' DATE  : 3/16/2006
' (C) 2006, All Rights Reserved
'
' COMMENT: 
'
'==========================================================================
Set WshShell = CreateObject("wscript.Shell")
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set env = WshShell.environment("Process")
strComputer = env.Item("Computername")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Const HKEY_LOCAL_MACHINE = &H80000002
Const UnInstPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
".\root\default:StdRegProv")
strDigitalProductId="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"
strXPKey=GetKey(WshShell.RegRead(strDigitalProductId))
Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
For Each objItem in colItems
	report = report &  "Original CD Key:"& strXPKey & 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

I hope you find this post helpful.

Regards,

Mark
 
I found a program called Belzrc advisor. It seemed to work. But gave me a bit to chew on...

 
Why install or purchase an external program when the OS will readily give you the info via script?

tfg13, thanks. I can always count on you to appreciate the beauty of scripts. :)

I hope you find this post helpful.

Regards,

Mark
 
LOL, me too! Last time I did an enum on my scripts USB drive I have about 850 of them and still growing.

I hope you find this post helpful.

Regards,

Mark
 
I thank you for your script markdmaac, however, I am not at the point to running scripts... I see your script and dont know how to use it. (embarrasing I know) However, if you sent me a link to read up on them, I will make it a strong point in learning!
Thanx

 
Yea, so I tried that! It gave me inaccurate Office information. Other than that it does the job.

 
Save the above code to a text file in notepad. Name it GetCDKeyandSerialNumber.vbs or getcd.vbs whatever you want so long as it has a VBS extension and not a TXT extension.

Then just double click the file. That is all that is needed.



I hope you find this post helpful.

Regards,

Mark
 
Markdmac, this script will get me the OS serial number but not the office 2000 serial number I need. Got a script for that?

 
I don't mean to tease, but yes. As of yesterday I investigated this issue and wrote the code for this for my Inventory script that is part of my Admin Script Pack. (sorry that one is for purchase only) Contact info is on my web site if you want details.


I hope you find this post helpful.

Regards,

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top