Showing posts with label SQL Server. Show all posts
Showing posts with label SQL Server. Show all posts

Sunday, 19 May 2013

Specifying TFS 2012 Express Database Location

Over the past few weeks I've been planning the migration of a number of source control repositories to new TFS 2012 repository.

I'm not sure how I'm going to handle the migration of the source files yet but I'll probably just check the existing sources into the new repository since keeping the history is not important.

Installing TFS 2012 Express edition was straight forward but it didn't set thing up as I wanted.

It installed the database into the programs files directory tree on the system drive which I didn't want since the system partition of my server does not have the majority of the free disk space and data should live on the data drive.

The easiest way I found to solve this issue was to install SQL Server Express 2012 before installing TFS 2012 Express. During the install of SQL Server Express 2012 you can easily set the location of the folder where it stores its databases. Once SQL Express 2012 was installed, you install TFS and it finds the instance of SQL Server Express 2012 you just installed and uses it and puts its collection databases in the SQL Server instance's default database directory.

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.

Thursday, 18 August 2011

Detecting SQL Server from wix installer

When creating an installer using wix (3.5 or later) some times you need to detect if the machine you are installing on has some form of SQL Server installed.

The following check for a 32 bit version of various kinds of SQL Server

<property id="SQLEXPRESS2005">
<registrysearch id="SQLExpress2005"
   key="Software\Microsoft\Microsoft SQL Server\90\Tools\ClientSetup\CurrentVersion"
   name="CurrentVersion"
   root="HKLM"
   type="raw" win64="no">
</registrysearch>
</property>

<property id="SQLEXPRESS2008">
<registrysearch id="SQLExpress2008"
   key="Software\Microsoft\Microsoft SQL Server\Instance Names\SQL"
   name="SQLEXPRESS"
   root="HKLM"
   type="raw"
   win64="no">
</registrysearch>
</property>

<property id="SQLSERVER">
<registrysearch id="SQLServer2005orLater"
   key="Software\Microsoft\Microsoft SQL Server\Instance Names\SQL"
   name="MSSQL"
   root="HKLM"
   type="raw"
   win64="no">
</registrysearch>
</property>

The following check for a 64 bit version of various kinds of SQL Server

<property id="SQLEXPRESS2005X64">
<registrysearch id="SQLExpress2005x64"
   key="Software\Microsoft\Microsoft SQL Server\90\Tools\ClientSetup\CurrentVersion"
   name="CurrentVersion"
   root="HKLM"
   type="raw" win64="yes">
</registrysearch>
</property>

<property id="SQLEXPRESS2008X64">
<registrysearch id="SQLExpress2008x64"
   key="Software\Microsoft\Microsoft SQL Server\Instance Names\SQL"
   name="SQLEXPRESS"
   root="HKLM"
   type="raw"
   win64="yes">
</registrysearch>
</property>

<property id="SQLSERVERX64">
<registrysearch id="SQLServer2005x64orLater"
   key="Software\Microsoft\Microsoft SQL Server\Instance Names\SQL"
   name="MSSQL"
   root="HKLM"
   type="raw"
   win64="yes">
</registrysearch>
</property>

The magic lines are win64="yes" to force a search of the 64 bit registry and win64="no" to search the 32 bit registry.

12/03/2013 Note: I've just noticed that the above bits don't work with WIX 3.7. They need the case of the elements and attributes changing to camel case.