PDA

View Full Version : Test for existence of SQL Server



morgan
10-01-2010, 06:45 PM
I have an installscript project which uses platform filtering = Windows Server 2003, and which tests for Microsoft SQL Server 2005 - and specifically the Reporting Services component - and if both are present, executes SQL and installs reports. Up until now I have relied on a RegDBGetKeyValueEx() search of the registry for "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server" containing InstalledInstances = MSSQLSERVER. This worked fine, but now we also need to support installs on Windows Server 2008 64-bit, and will be supporting both Microsoft SQL Server 2005 & 2008.

Is there a better way to test for the existence of MS SQL Server 2005 or 2008, including Reporting Services, on both 32-bit and 64-bit Windows Server 2003 & 2008?

Thanks,

Morgan

hidenori
10-04-2010, 10:39 AM
Check out the REGDB_OPTIONS system variable (http://helpnet.flexerasoftware.com/robo/projects/installshield17langref/LangrefREGDB_OPTIONS.htm).

morgan
10-04-2010, 12:22 PM
Check out the REGDB_OPTIONS system variable (http://helpnet.flexerasoftware.com/robo/projects/installshield17langref/LangrefREGDB_OPTIONS.htm).

Thanks. This worked:


< RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE );
< sKey = "Software\\Microsoft\\Microsoft SQL Server";
< sValue = "InstalledInstances";
< nResult = RegDBGetKeyValueEx( sKey, sValue, nType, sData, nSize );
---
>
> if (SYSINFO.bIsWow64) then
> REGDB_OPTIONS = REGDB_OPTIONS | REGDB_OPTION_WOW64_64KEY;
> endif;
>
> RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE );
> sKey = "Software\\Microsoft\\Microsoft SQL Server";
> sValue = "InstalledInstances";
> nResult = RegDBGetKeyValueEx( sKey, sValue, nType, sData, nSize );


Morgan