Extract SQL Server 2012 Product Key from MSDN or SPLA media

20170522112224When you install SQL Server 2012 using MSDN or SPLA media you never see the actual license. In my case, my company uses the Microsoft Services Provider License Agreement  (SPLA) which is for service providers and independent software vendors (ISVs) who want to license Microsoft software products to provide software services and hosted applications to end customers. SPLA Licensing for SQL Server is pre-pidded, where product key is actually built into the installer.  So if you need to apply that SPLA product key to another SQL Server instance, it needs to be extracted from the SQL Server 2012 ISO. The steps below will show how this can be done.

Finding the Product Key

1. Locate the SQL Server 2012 media and mount it:

20170526003234

2. Once mounted open the relevant drive in Windows Explorer and open the x64 folder:

20170526002844

3. Locate the DefaultSetup.ini file:

20170526002944

4. Open it in Notepad and make a note of the the Product Key:

20170526002647

That’s it! Now that you have obtained the Product Key you can apply it to another SQL Server Instance. If you want instructions on how to do this, following the instructions in this post.

Change Product Key in Windows Server 2012 via command line

To change the Product Key on Windows Server 2012 and activate it via command line run the following commands below.

To remove all installed keys run the following command:

 slmgr.vbs -upk 

To add the new key, run the command below:

slmgr.vbs -ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX

Obviously change XXXXX-XXXXX-XXXXX-XXXXX-XXXXX with your actual key.

And that’s it! The Product Key has been changed and activated successfully. If you have to do this many times it makes sense to script this, so the batch file below achieves all the steps above in one go:

::Remove all installed keys
slmgr.vbs -upk

::Install new product key
slmgr.vbs -ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX

I hope this helps you save a bit of time and energy!