This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: How to get a registry key (not string value)
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 29, 2013
10:55 AM
How to get a registry key (not string value)
Can someone tell me how I can get a key value from the registry? I've seen examples of how to get a registry value from a string but I am looking for a key value.
For example, I am trying to determine if a machine has .NET Framework 4.0 installed on it. The key I'm trying to look at is [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319]. I'd like to retrieve v4.0.30319 into a string and give a message if that key is not available.
Thanks!
For example, I am trying to determine if a machine has .NET Framework 4.0 installed on it. The key I'm trying to look at is [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319]. I'd like to retrieve v4.0.30319 into a string and give a message if that key is not available.
Thanks!
(11) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 29, 2013
11:46 AM
There's RegDBKeyExist if you know the exact key beforehand and just want to make sure it exists, or RegDBQueryKey if you want a list of subkeys.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 29, 2013
02:49 PM
Thanks, Robert. If I do a query and get a list of keys, is there a way to find a particular key then do a substr() on it? For example, if I'm looking for version numbers in HKLM\SOFTWARE\Microsoft\.NETFramework, can I get v.4.0, v.3.0, etc?
The exists function works for me for now because I know what I'm looking for, though.
The exists function works for me for now because I know what I'm looking for, though.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 02, 2013
06:12 PM
There's ListFindString, if you know the complete string to find. (In that case you could just use -KeyExist, though.) Otherwise, you'll probably have to loop over the list items (ListGetFirst/NextString), see if what you want is in a particular item, and then use StrSub to get the range of characters you need.
Robert
Robert
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 02, 2013
07:06 PM
It is impossible to read a "key" into a string because a key doesn't have data. Only Values have data.
Hive | Key | SubKey | Value [DATA]
Hive | Key | SubKey | Value [DATA]
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 03, 2013
11:42 AM
Please look at RegDBQueryKey.
This function allow you to list all SubKeys.
This function allow you to list all SubKeys.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 11, 2013
10:30 AM
I'm basically looking to find out if the "Version" for these keys are 10.50.x.x:
Both those keys have a string, "Version", I'm looking for but the keyname after MSRS10_50. will obviously be different. Is there I was I can get that info to determine if SQL Server 10.50.x.x is installed?
Thanks!
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\Setup
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Setup
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Setup
Both those keys have a string, "Version", I'm looking for but the keyname after MSRS10_50. will obviously be different. Is there I was I can get that info to determine if SQL Server 10.50.x.x is installed?
Thanks!
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 11, 2013
12:02 PM
I believe that registry key implies that an instance of SQL Server named MSSQLSERVER is installed. Do you want to be that tightly coupled?
Personally I leverage the built-in SQL handling of InstallShield. I use the SQLLogin dialog and SQL Connections features to have InstallShield do a test connection to the server and verify that it meets my version requirements. Would this not meet your needs?
Personally I leverage the built-in SQL handling of InstallShield. I use the SQLLogin dialog and SQL Connections features to have InstallShield do a test connection to the server and verify that it meets my version requirements. Would this not meet your needs?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 11, 2013
12:32 PM
Christopher Painter wrote:
I believe that registry key implies that an instance of SQL Server named MSSQLSERVER is installed. Do you want to be that tightly coupled?
Personally I leverage the built-in SQL handling of InstallShield. I use the SQLLogin dialog and SQL Connections features to have InstallShield do a test connection to the server and verify that it meets my version requirements. Would this not meet your needs?
No, this wouldn't be ideal for our needs (although it's a great idea!). We basically want the installer to check to see if certain prereqs are installed. If not, produce a message saying what's missing and abort.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 11, 2013
01:56 PM
I'm using RegDBQueryKey to make a list of the keys in HKLM\Software\Microsoft\Microsoft SQL Server. I know I can use ListFindString to find a line of data in the queried list, but can I have it search for just part of a value? For example look for MSSQL10_50 instead of MSSQL10_50.MSSQLServer?
I think the ListFindKeyValueString function might be the answer but I can't find any examples on how to use it.
Thanks!
I think the ListFindKeyValueString function might be the answer but I can't find any examples on how to use it.
Thanks!
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 11, 2013
04:53 PM
I'm not aware of a single function to do that. You might have to loop over the items and see if the string you want is there as mentioned in [post=486463]#4[/post].
![](/skins/images/3B39CE851FDD5528C393F146EB70A2D0/responsive_peak/images/icon_anonymous_message.png)