Monday 3 September 2012

Uninstalling SQL Server from Windows 2008 R2 server core

How hard can it be to uninstall SQL Server from Windows Server 2008 R2 core?

It should be straight forward but first I had to find the magic uninstall command - setup.exe which is located in the Setup Bootstrap\SQLServer2012 folder in the folder that SQL server 2012 was installed in to in the first place. On my machine this is C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\SQLServer2012.

It took me some time but eventually I found the following command worked
setup /action=uninstall /FEATURES=SQL,Tools,RS,AS,IS /INSTANCENAME=MSSQLSERVER /UIMODE=EnableUIOnServerCore.
I tried using /QS instead of /UIMODE=EnableUIOnServerCore but it couldn't find any features to uninstall!

It also allowed me to select all of the components including the shared components - which is the only way I found to remove all of them apart from the native client.

To remove the Native Client use:
msiexec /uninstall {49D665A2-4C2A-476E-9AB8-FCC425F526FC}

It does leave a few log files and empty directories floating around but they are easily cleaned up.