Site icon Ryadel

SQL Server - Retrieve Product Key from an existing installation

SQL Server - Recuperare il Product Key da una installazione esistente

Sometimes you'll need to retrieve your SQL Server Product Key from an existing installation on your Client or Server machine: the most common scenario takes place when you have an old Server to move or relocate and no one around you seem to remember where the license are... or if you've simply lost the Service Key post-it.

Luckily enough, you can easily get this information back thanks to this neat PowerShell script made by Jacob Bindslet:

The script works with any SQL Server edition & version starting from 2005: SQL Server 2005, SQL Server 2008 and SQL Server 2008 R2. Pay close attention, though, if you're using Sql Server 2012 or Sql Server 2014 you'll have to make some small modifications to that code.

For Sql Server 2012 you need to replace two lines of code. In details, replace line 5 with the following line:

And also replace line 16 with the following line (thanks to gprkns for pointing it out):

You can also take a look of the complete script code for Sql Server 2012 at the following link.

For Sql Server 2014, Microsoft moved the   DigitalProductID  node to the actual instance name in the registry, so you will need to replace line 5 with something similar to the following (depending on your installation):

All you have to do in order to execute this script is to perform these actions:

  • Launch a PowerShell prompt (Start > Run, then type powershell and press ENTER.
  • Copy the above function text and past it directly inside the prompt area.
  • Press ENTER a couple times, just to be sure you're back to the prompt.
  • Type GetSqlServerProductKey, then press ENTER.

If everything has been done like it should you'll be able to see the following informations:

sql-server-2008-retrieve-product-key

As you can see there's a lot of stuff regarding your SQL Server installation, most of them you should know already, the latter being the Product Key.

That's all for now: happy recover!

Exit mobile version