On my post about the SP2 bug, I had a comment by Bert Johnson about a post of his explaining how to recover the SharePoint 2007 Product ID from your system. This is indeed very handy if you do not happen to have it or find it anymore and do not want to bother your customer for it loosing face (again [:D])
Bert wrote a vbs script that decodes the Product ID from the registry key blob data where it resides.
Thanks Bert for sharing this information, which will probably help a lot of us out there.
Subscribe to Bert’s blog with this Feed: http://blogs.pointbridge.com/Blogs/johnson_bert/_layouts/listfeed.aspx?List={071A5AE9-9B1F-44E7-8AF7-C0BC07CF531D}
The original post can be found at http://blogs.pointbridge.com/Blogs/johnson_bert/Pages/Post.aspx?_ID=10 .
Here is the script :
' Extract MOSS 2007 Product ID
' Written by Bert Johnson (PointBridge)
' http://blogs.pointbridge.com/Blogs/johnson_bert/Pages/Post.aspx?_ID=10
Const HKEY_LOCAL_MACHINE = &H80000002
Set reg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
wscript.echo GetKey("SOFTWARE\Microsoft\Office\12.0\Registration\{90120000-110D-0000-0000-0000000FF1CE}", "DigitalProductId")
Public Function GetKey(path, key)
Dim chars(24), prodid
Dim productkey(14)
reg.GetBinaryValue HKEY_LOCAL_MACHINE, path, key, prodid
For ib = 52 To 66
productkey(ib - 52) = prodid(ib)
Next
'Possible characters in the Product ID:
chars(0) = Asc("B")
chars(1) = Asc("C")
chars(2) = Asc("D")
chars(3) = Asc("F")
chars(4) = Asc("G")
chars(5) = Asc("H")
chars(6) = Asc("J")
chars(7) = Asc("K")
chars(8) = Asc("M")
chars(9) = Asc("P")
chars(10) = Asc("Q")
chars(11) = Asc("R")
chars(12) = Asc("T")
chars(13) = Asc("V")
chars(14) = Asc("W")
chars(15) = Asc("X")
chars(16) = Asc("Y")
chars(17) = Asc("2")
chars(18) = Asc("3")
chars(19) = Asc("4")
chars(20) = Asc("6")
chars(21) = Asc("7")
chars(22) = Asc("8")
chars(23) = Asc("9")
For ib = 24 To 0 Step -1
n = 0
For ikb = 14 To 0 Step -1
n = n * 256 Xor productkey(ikb)
productkey(ikb) = Int(n / 24)
n = n Mod 24
Next
sCDKey = Chr(chars(n)) & sCDKey
If ib Mod 5 = 0 And ib <> 0 Then sCDKey = "-" & sCDKey
Next
GetKey = sCDKey
End Function



Thanks! Just had to change the ’110D’ in line 8 to ’0017′ and it worked perfect! I got a new laptop for work and needed to re-install SharePoint Designer on the new laptop, but didn’t have the product key recorded anywhere. This saved me a lot of hassle.
This is awesome, thanks! I had to update the GUID in the registry key.
You are the man.
Dirk,
The links to both subscribe, and visit the original blog post don’t work. The original post’s URL asks to log in, and the subscribe link errors out, which I’m assuming because again, I’m not logged in. Is there a public-facing URL to visit the blog post?
I tried running this script on my Windows Server 2008 Enterprise with MOSS 2007 SP2 VM, but it returns the error:
C:\Users\sharepoint.admin\Desktop\ExtractMOSS2007ProductID.vbs(17, 9) Microsoft VBScript runtime error: Type mismatch: ‘prodid’
Any idea what’s going on?
Hi Ken,
I just checked and indeed it seems that Bert’s blog is out of the air.
For your error, the only reasons I can think of is that either you are running the script without administrator privileges and it does not have access to your registry hive or it does not have access to call WMI (maybe WMI service not started)
best regards,
Dirk
Absolute Legend
Works like a charm ! Thank you !