Migrating MS SQL 2k8 license from one machine to another

Posted on 2014-07-15
Last Modified: 2014-07-22
We have an old server with MS SQL 2008 on it that we want to move to a new server.  We would like to use the same license.  Originally, when the old server was sold to us we were given no documentation.  How do we dig up the license from the old server?  I'm assuming this is like MS Office where you get a key and just reinstall using the same key.  However, I can't seem to find the key...  Any advice on what to do in this situation?
Question by:Tim Phillips
    LVL 9

    Expert Comment

    Try magical jelly bean
    There are a few other apps that will do the same. Belarc advisor is another one. You can install SQL in a 180 day trial mode while you get this sorted.
    LVL 6

    Author Comment

    by:Tim Phillips
    Just tried MJB and it didn't find anything and neither did Belarc.
    LVL 9

    Expert Comment

    Here is a list of 20 or so, with links,

    And here is a small program some cat wrote to decode SQL 2008's key from the registry.
    LVL 6

    Author Comment

    by:Tim Phillips
    I tried a few of those and the "small program", but nothing worked.  Any other ideas?
    LVL 9

    Accepted Solution

    I found this on:

    Run the Powershell script below on your SQL server:

    function Get-SQLserverKey {
        ## function to retrieve the license key of a SQL 2008 Server.
         param ($targets = ".")
        $hklm = 2147483650
        $regPath = "SOFTWARE\Microsoft\Microsoft SQL Server\100\Tools\Setup"
        $regValue1 = "DigitalProductId"
        $regValue2 = "PatchLevel"
        $regValue3 = "Edition"
        Foreach ($target in $targets) {
            $productKey = $null
            $win32os = $null
            $wmi = [WMIClass]"\\$target\root\default:stdRegProv"
            $data = $wmi.GetBinaryValue($hklm,$regPath,$regValue1)
            [string]$SQLver = $wmi.GetstringValue($hklm,$regPath,$regValue2).svalue
            [string]$SQLedition = $wmi.GetstringValue($hklm,$regPath,$regValue3).svalue
            $binArray = ($data.uValue)[52..66]
            $charsArray = "B","C","D","F","G","H","J","K","M","P","Q","R","T","V","W","X","Y","2","3","4","6","7","8","9"
            ## decrypt base24 encoded binary data
            For ($i = 24; $i -ge 0; $i--) {
                $k = 0
                For ($j = 14; $j -ge 0; $j--) {
                    $k = $k * 256 -bxor $binArray[$j]
                    $binArray[$j] = [math]::truncate($k / 24)
                    $k = $k % 24
                $productKey = $charsArray[$k] + $productKey
                If (($i % 5 -eq 0) -and ($i -ne 0)) {
                    $productKey = "-" + $productKey
            $win32os = Get-WmiObject Win32_OperatingSystem -computer $target
            $obj = New-Object Object
            $obj | Add-Member Noteproperty Computer -value $target
            $obj | Add-Member Noteproperty OSCaption -value $win32os.Caption
            $obj | Add-Member Noteproperty OSArch -value $win32os.OSArchitecture
            $obj | Add-Member Noteproperty SQLver -value $SQLver
            $obj | Add-Member Noteproperty SQLedition -value $SQLedition
            $obj | Add-Member Noteproperty ProductKey -value $productkey
    LVL 6

    Author Comment

    by:Tim Phillips
    Ended using the current version of SQL 2012 Express as it meets our needs.  The script wouldn't work for me.  Good try though.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    This is basically a blog post I wrote recently. I've found that SARGability is poorly understood, and since many people don't read blogs, I figured I'd post it here as an article. SARGable is an adjective in SQL that means that an item can be fou…
    In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now