cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
morgan
Level 4

Test for existence of SQL Server

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
Labels (1)
0 Kudos
(2) Replies
hidenori
Level 17

0 Kudos
morgan
Level 4

hidenori wrote:
Check out the REGDB_OPTIONS system variable.


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
0 Kudos