Question

I know this has been asked before, but bear with me. I have a utility that reads the Unistall location in the registry and then compares the results to a list of applications that need to be removed. 80% of the time this works, but the trick is that one of the items to be removed is the anti-virus (so it can be replaced with an AVG install). For a lot of the companies this doesn't work. Here is a snippet of how I'm getting the installed software:

const string Win32Loc = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
//const string Win32Loc = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\USerData\S-1-5-18";     
    const string Win64Loc = @"Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall";

    List<Application> apps = new List<Application>();
    string location = bool64BitOs ? Win64Loc : Win32Loc;

    using (RegistryKey rk = Registry.LocalMachine.OpenSubKey(location))
    {
        foreach (string skName in rk.GetSubKeyNames())
        {
            using (RegistryKey sk = rk.OpenSubKey(skName))
            {
                apps.Add(new Application { DisplayName = sk.GetValue("DisplayName") == null ? "" : (string)sk.GetValue("DisplayName"), AppKey = skName });
            }
        }
    }

The results look like this when written to a text file:


Name PowerDVD Key InstallShield_{6811CAA0-BF12-11D4-9EA1-0050BAE317E1}

Name ESC Home Page Plugin Key InstallShield_{E738A392-F690-4A9D-808E-7BAF80E0B398}

Name Intuit SiteBuilder Key Intuit SiteBuilder

Name Microsoft Visual J# 2.0 Redistributable Package Key Microsoft Visual J# 2.0 Redistributable Package

Name Norton AntiVirus Key NAV

Name Windows Live Essentials Key WinLiveSuite

Name Microsoft Visual C++ 2008 ATL Update kb973924 - x86 9.0.30729.4148 Key {002D9D5E-29BA-3E6D-9BC4-3D7D6DBC735C


So you'll see that SOME installs have the key and some don't. What this means is that the 80% that work have the key for the MSIEXEC call, and the others fail. I'm playing with the Installer/UserData/UserXXXXX/Products but I don't get how to traverse for all users. In the dump I provided, Norton needs to go, but I can't see how to do it.

Any help would be greatly appreciated.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top