Uninstalling SQL Server 2008 R2 Evaluation Edition

Original post by Aaron Bertrand

Note that much of these instructions also work for SQL Server 2012 Evaluation Edition, many of which will start expiring soon…

Here we go ’round the uninstall bush…
Today I spun up a rather aging VM so that I could take some screen shots from the 2008 R2 version of Management Studio.

When I clicked on my shortcut, I received this error:

For searchability, here is the text (with an actual clickable link, imagine that):

—————————
Microsoft SQL Server Management Studio
—————————
Evaluation period has expired. For information on how to upgrade your evaluation software please go to http://www.microsoft.com/sql/howtobuy
—————————
OK
—————————

Of course what this meant was that, for this particular VM, I had installed an Enterprise Evaluation instance before the RTM bits for Developer Edition were available.  And clearly this happened more than 180 days ago, and I forgot about it.

If you go the link (which ends up at http://www.microsoft.com/sqlserver/en/us/default.aspx), there isn’t really any information about converting evaluation software to licensed software (even if I already have licensed bits in hand).  In fact there is not really any information about Evaluation Edition at all, except for an offer to install a second trial instance on my machine.  I’m trying to remove one, but thanks anyway.

So the first thing I do is to install a real, licensed version of SQL Server 2008 R2 Developer Edition.  I figure, if anything, it will at least give me a functional Management Studio again, even if I have an outdated Evaluation Edition engine lying around.  Nope, I run through install, and when I try to launch Management Studio, my evaluation period has still expired.  I plead to #sqlhelp on twitter, and I’m told I need to remove all of the 2008 R2 bits.  This was the first time I’d had any reason to uninstall 2008 R2; at my previous job, we had only just migrated to 2008 in production late last year.  I guess I should test cleanup more often.

Now, removing SQL Server 2008 R2 turns out to be a much bigger challenge than you might expect.  Sure, you can go through the Control Panel and uninstall all of the components individually, but this is a hassle, and it still might not work very smoothly.  To clear a path, I’ve been uninstalling applications that might be related (e.g. Visual Studio), and even applications with no hope in hell of being related: Office 2010, Flash, Windows Live “Essentials”… I even uninstalled an instance of SQL Server 2008 (not an eval), and when I tried to remove the setup support files, I received this warning:

Why on earth are the R2 Common Files dependent on SQL Server 2008 Setup Support Files?  And further to that, I’d like to know why, when I clicked No on this dialog, it seemed to remove the SQL Server 2008 Setup Support Files anyway.  It turns out there is some flag that removes the entry from the Programs and Features list, even if you don’t go through with the uninstall.  All was returned to normal when I closed the window and opened it again.

Anyway, let’s see what happens when I try to remove R2 via the Control Panel.  I right-click the item in the list (and as you can see, “the list” is pretty short – and never mind the blurred out entries, I’ll talk more about those soon, and they aren’t related to R2):

When I choose Uninstall/Change, I get this box, and I click Remove of course:

When I click Remove, I get the Setup Support Rules dialog (just like I do for a new installation), and then when I click OK, I get this lovely dialog (I trimmed it so I wouldn’t have to shrink it, but you get the gist):

Why does this not seem like it will end well?

Because according to the dialog, nothing is going to be removed (usually you see actual features with checkboxes).  I should not even be able to see a Next > button.  But for fun, I’ll click it anyway, since my only other option at this point is to Cancel.  I click Next > a couple of times, then a big shiny Remove button, and then after several seconds I get another even more lovely dialog, indicating that the uninstall has crashed:

And again for searchability (typo and all):

TITLE: SQL Server Setup failure.
——————————

SQL Server Setup has encountered the following error:

No feature were uninstalled during the setup execution. The requested features may not be installed. Please review the summary.txt logs for further details.

Error code 0x84B30002.

——————————
OK
——————————

At this point I’ve spent more time on this than I would have if I had just built a brand new VM and.  But I was determined to see it through.  So I finally gave in and decided to go the msiexec.exe /x route.  I located all of the R2-related GUIDs in the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\

Here is one example:

So I went through the entire list, and saved the following commands to a batch file:

rem DisplayName
msiexec /x “{guid}”

And I also added one that wasn’t in the GUID list; there was a key under Uninstall called “Microsoft SQL Server 2008 R2” with the following properties:

Here is what my final .bat file looked like. You’ll note that I put the Setup Support Files last.  Also please note that your set of GUIDs may be different than mine… I’m just listing what I did as an example:

rem SQL Server 2008 R2 Common Files
msiexec /x “{234F6B0D-10AE-4BB7-B2F3-E48D4861952D}”

rem SQL Server 2008 R2 Common Files
msiexec /x “{36F70DEE-1EBF-4707-AFA2-E035EEAEBAA1}”

rem SQL Server 2008 R2 Database Engine Shared
msiexec /x “{A2122A9C-A699-4365-ADF8-68FEAC125D61}”

rem Microsoft SQL Server 2008 Setup Support Files
msiexec /x “{C0C690C8-F335-4BA4-A2AD-675EAD1DFA90}”

rem SQL Server 2008 R2 Database Engine Shared
msiexec /x “{C942A025-A840-4BF2-8987-849C0DD44574}”

rem Microsoft SQL Server 2008 R2 (64-bit)
msiexec /x “{20E42995-BBE9-4697-8394-FCDC4338706B}”

rem Microsoft SQL Server 2008 R2 Setup (English)
msiexec /x “{C3E48238-5FA0-4C82-9509-36D47E371A29}”

Running through these, I had several that returned a dialog about an unexpected error, but I ignored those and plowed through.  When I was finished, I ran the batch file again, and every line item raised this dialog:

This is a good thing; it smells like I’m almost home.  So – finally – I try to run SQL Server 2008 R2 setup again.  To avoid some wasted time, I install only the Management Tools on my first run.  Though, if I’m being honest, even installing just the client tools takes several minutes.  Precious, Monday Night Football minutes.

And, believe it or not, we have success.

That was WAY too painful, and I’ll never get that time back. Hopefully this post will prevent you from going down a similar rathole.  My advice:

  1. Build VMs with the expectation that they may need to be paved over and rebuilt from scratch.  Keep SQL Server installation files, service packs, hotfixes, and slipstreamed sources handy on a non-virtualized machine or on removable storage.
  2. Try everything in your power to avoid Evaluation Edition. Spend the $49 on Developer, and stop watching the clock or coming up with schemes to set your clock back to the 1980s.  Developer is not free like the eval, but it will be easier to migrate / replace than an expired evaluation.  I would have gladly spent $49 to not go through what I just documented here.
  3. When someone tells you to pave over your VM because R2 “does not uninstall nicely,” listen to them.  I have two VMs that were in this state at the beginning of the day.  I’ll let you guess how I’m going to deal with the second one.
  4. Because it bears repeating: avoid Evaluation Edition if there is any chance at all the software will be expected to outlast the 180-day trial period.  If you can’t avoid it, when you’re done evaluating, perform a thorough cleansing of your machine.  You never know how old software can learn new, frustrating tricks.
Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s