cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Swilks
Level 5

Registry Search

Hello All,

As I understand when I do a registry search I must search a specific value or in a specific key. Is there anyway I can have the search search a specific value anywhere below a certain key like the file search function performs to a number of levels ?

It may help to understand why.
Im installing a SQL database MDF file (demonstration data included) and then using SQL Scripts to attach that database to the selected SQL Server during the installation process.

What I would like to do is to default the INSTALLDIR for the mdf files to the default data folder for the SQL server

This is where the problem occurs. There are numerous locations that the SQL Server "SQLDataRoot" key can be found in the registry dependant upon the number of SQl Server instances that have been installed to that server and also dependant upon what SQL Server version they are using.

The thought would be to search for a "SQLDataRoot" key anywhere under HKLM\Software\Microsoft and set the returned value as the INSTALLDIR.

However I cannot do this because I must specify in the system search the exact location of the SQLDataRoot key which I cannot possibly known given the variables of versions and SQL server instances.

Any suggestions ?
Any help provided would be greatly appreciated.

regards
Shaun
Labels (1)
0 Kudos
(2) Replies
RobertDickau
Flexera Alumni

I'll have to defer to someone else for a specific SQL solution, but you are correct that the Windows Installer registry-search functionality does not support searching registry subkeys for a particular value.

Using an InstallScript custom action, you can repeatedly call RegDBQueryKey in a custom action to query registry subkeys, but the built-in AppSearch and related tables do not support this.
0 Kudos
ericpaul
Level 6

Hello Shaun, you can set up an InstallScript Custom Action and implement the search yourself in the corresponding InstallScript function using RegDBxxx functions such as RegDBSetDefaultRoot, RegDBKeyExist and so on.
Having found the correct path, you can then set INSTALLDIR accordingly.

Eric-Paul
0 Kudos