Jump to content

Reading the registry


brian873

Recommended Posts


Sorry I really need to check my typing

When an application is installed silently, I would like to write a registry value to say it was installed. Then at a later date I would like to have the ability to scan a registry for all of the values that I flag as installed. So I could get an output like

Winzip = 1 installed

OfficeXP = 0 not installed

AVG = 1 installed

Hope this explains better

Link to comment
Share on other sites

Thanks Soulin I will try it myself and post the results, one thing you could help me with is the best place to write me own values or does it matter ? I was thinking of using

HKEY_LOCAL_MACHINE / SOFTWARE / _MY SOFTWARE /

{string values}

winzip

office

AVG

What do you think ???

Link to comment
Share on other sites

Soulin is correct. You can use REG ADD and REG QUERY to write and read data from the registry. Errorlevels are returned for the presence or absence of the value for which you query.

Also of note: In many instances, programs will write registry keys and values when they are installed (silently or otherwise). You can often determine these on your own and query for them without needing to add a custom entry yourself. *Most* applications write a subkey to HKLM\SOFTWARE\. That's usually the first place to check for registry entries. They will most often appear under either the application name, or the company name. Many developers (but not all, unfortunately) even include values reflecting program versions. This can be handy in certain circumstances.

- Ravashaak

Link to comment
Share on other sites

HKEY_LOCAL_MACHINE / SOFTWARE / _MY SOFTWARE /

{string values}

winzip

office

AVG

What do you think ???

I see no problem with your structure. However, you might want to write a subkey for each application instead of just values all lumped into one key. It really depends upon your needs. However, if you created subkeys for each application, you could create a value for the application version within each subkey (just in case you later needed an easy way to programatically determine the installed version of an application).

- Ravashaak

Link to comment
Share on other sites

2brian: It depends :) For example I am creating GUID values... If you want to use per user installations, you must make it to HKCU, if per-computer, you must make it in HKLM...

2ravashaak: For example I am using this method when I want to make per-computer settings, that will occur only once (yesterday I deployed collector from Application Compatibility Toolkit using this method)

Link to comment
Share on other sites

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

I would monitor them here. The uninstall keys are here when installed, and removed upon uninstall. Seems the most suitable to myself, to choose.

Link to comment
Share on other sites

Thanks guys.... got it working with

Command

REG QUERY HKLM\Software\_MYSOft /s

Output

! REG.EXE VERSION 3.0

HKEY_LOCAL_MACHINE\Software\_MYSOft

HKEY_LOCAL_MACHINE\Software\_MYSOft\AVG

<NO NAME> REG_SZ

Installed REG_SZ 0

HKEY_LOCAL_MACHINE\Software\_MYSOft\Office

<NO NAME> REG_SZ

installed REG_SZ 1

HKEY_LOCAL_MACHINE\Software\_MYSOft\Wizip

<NO NAME> REG_SZ

Installed REG_SZ 0

Soulin, excuse my ignorance but where do you write GUID values and what are the benefits of doing it this way ?

thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...