Reading the SQL 2005 instance and installation directory from a DOS batch file
Posted by: JonGalloway.ToString(),
on 29 Oct 2006 |
View original | Bookmarked: 0 time(s)
SQL 2005 installs each instance to a numbered directory based on the order installed: MSSQL.1, MSSQL.2, etc. That makes scripting a little tricky. Fortunately, you can find them in the registry.
The install path for the SQL 2005 database server is here:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\SQL2005\Setup\SQLPath
You can look up specific instances in the the Instance Names registry node. For instance, to find the SQL2005 instance, you'd look at this key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft...