Recover SharePoint 2013 installation key

I was reinstalling SharePoint 2013 Server in the lab tonight and discovered that I didn’t have the original license key that it was installed with. Googled online and found a number of Powershell scripts that claim to recover the key from the registry, but none of them worked – except this one, which was originally posted as a comment by KEMiCZA here. I can confirm that it worked for me.

This one should work SP-2013
function Get-SP2013ProductKey {
$map=”BCDFGHJKMPQRTVWXY2346789″
$value = (get-itemproperty “HKLM:\SOFTWARE\Microsoft\Office\15.0\Registration{90150000-110D-0000-1000-0000000FF1CE}”).digitalproductid
$baseAddress = 808
$needsN = ($value[$baseAddress + 14] -shl 3) -and 1;
$ProductKey = “”
for ($i = 24; $i -ge 0; $i–) {
$r = 0
for ($j = 13; $j -ge 0; $j–) {
$test = $value[$baseAddress + $j]
$r = ($r * 256) -bxor $value[$baseAddress + $j]
$floor = [math]::Floor(double)
$value[$baseAddress + $j] = $floor
$r = $r % 24
}
$ProductKey = $map[$r] + $ProductKey
}
if($needsN)
{
$firstLetterIndex = 0
for ($i = 0; $i -lt $ProductKey.Length; $i++) {
if($ProductKey[0] -eq $map[$i])
{
$firstLetterIndex = $i
break
}
}
$ProductKeyWithN = $ProductKey = $ProductKey.substring(1) # Remove first character
$ProductKeyWithN = $ProductKeyWithN.SubString(0, $firstLetterIndex) + “N” + $ProductKeyWithN.SubString($firstLetterIndex)
$ProductKeyWithN = $ProductKeyWithN.SubString(0, 5) + “-” + $ProductKeyWithN.SubString(5, 5) + “-” + $ProductKeyWithN.SubString(10, 5) + “-” + $ProductKeyWithN.SubString(15, 5) + “-” + $ProductKeyWithN.SubString(20, 5)
}
$ProductKeyWithN
}
Get-SP2013ProductKey

0 Responses to “Recover SharePoint 2013 installation key”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s




RSS Information Week Headlines

  • An error has occurred; the feed is probably down. Try again later.

RSS SharePoint Team Blog

  • An error has occurred; the feed is probably down. Try again later.

RSS InfoPath Team Blog

  • An error has occurred; the feed is probably down. Try again later.

RSS Joel Oleson Blog

  • An error has occurred; the feed is probably down. Try again later.

RSS Bud Ratliff blog

  • An error has occurred; the feed is probably down. Try again later.

RSS Susan Hanley’s KM Blog

  • An error has occurred; the feed is probably down. Try again later.

Blog Stats

  • 380,362 hits

%d bloggers like this: