I've come across a few issues while attempting to uninstall SQL Server 2008 November CTP a couple weeks ago, and thought I'd blog about as it may help someone. What I wanted to do was, upgrade to the February CTP, however this wasn't possible, hence my obvious course of action was to uninstall the November CTP. I went about this as expected. I launched Programs and Features (Windows Vista), selected Microsoft SQL Server 2008 and clicked the Uninstall button as shown in the screenshot below.

image

The SQL Server  2008 uninstall program was launched, I selected the desired SQL Server 2008 instance and proceeded through the wizard.

image

I removed the checkbox from the components I wanted to remove, and again, continued through the wizard. The wizard then began to uninstall SQL Server 2008 November CTP, however the uninstall failed.

image

I began to research the cause of this issue, I examined the log file and found a few errors within the log:

Failed to find installation media path due to datastore exception in FindSetupFolder()

Upon research, I discovered that the installation media path is C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap. I suspect the problem to be the fact that I ran the February CTP installation and allowed it to install the installation support files, thus overwriting the content of the Setup Bootstrap folder and ruining my chances of an easy uninstall. Never the less, I cant be 100% sure of this statement as I didn't analyze the cause in detail. What I was concerned with was uninstalling the program!

Reading the SQL Server 2008 readme file, I found a section titled How to Remove a Failed SQL Server 2008 Installation, which states the following:

To determine if there is an upgrade failure that can be uninstalled and then reinstalled, search for the following string in the detailed Setup log located at <drive>:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\<YYYYMMDD_HHMM>\<ComputerName>_YYYYMMDD_HHMM_Detail.txt: Feature <Name of feature> failed

The readme file states that all SQL Server 2008 features will have to be uninstalled manually, this can be done by executing the following command from within the C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap folder:

Setup100.exe /Action=uninstall /INSTANCENAME=<enter the Instance name>/Features=<Feature>

The feature should be SQL for the Database Engine, AS for Analysis Services, RS for Reporting Services and TOOLS for the client tools.

However, the above procedure didn't seem to do the trick, the installation wizard was launched and I experienced the same problem, that is, the uninstall failing. Finally, SQL Server 2008, as with pretty much all modern Windows applications makes use of the Windows Installer, which as a command line utility called msiexec.exe, you may or may not be familiar with this utility, but you can install and uninstall programs installed onto your computer by Windows Installer Services. The valid switches for this program can be found on Microsoft's TechNet page (http://technet2.microsoft.com/windowsserver/en/library/9361d377-9011-4e21-8011-db371fa220ba1033.mspx?mfr=true).

The switch to uninstall a program is /x, thus:

msiexec.exe /x <ProductCode>

To retrieve the product code we can search the registry for our SQL Server 2008 installation. However, you can also imply browse to the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\100\Uninstall Info. Notice that beneath this key are others identified by a GUID. If you browse to each key, you'll find a string property named Product, for example, if the Product string has the value of SQL Engine, then this is the SQL Server 2008 Engine, Client_Components is the client components, etc. The trick is, running msiexec.exe /x for each SQL Server 2008 feature that has been installed. For example,

msiexec.exe /x {8151C56C-5426-481C-96AF-F221FE1A10F2}msiexec.exe /x {433054F5-3929-426F-AE87-13666694365C}

This command should be run from a command prompt, once executed, the Windows Installer will launch and begin uninstalling the specified components.

image 

That's seemed to do the trick for me. Hope this helps.