I have tried this approach to get the list of add/remove programs and it still does not give the exact list
Look in at the registry in 3 places
installedSoftware.AddRange(GetInstalledSoftware(@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"));
installedSoftware.AddRange(GetInstalledSoftware(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"));
installedSoftware.AddRange(GetInstalledSoftware(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"));
Code:
private List<string> GetInstalledSoftware(string regKey)
{
var installedSoftware = new List<string>();
using (RegistryKey key = Registry.LocalMachine.OpenSubKey(regKey))
{
if (key != null)
{
foreach (string subkey_name in key.GetSubKeyNames())
{
using (RegistryKey subkey = key.OpenSubKey(subkey_name))
{
object displayName = subkey.GetValue(ToolResources.DisplayName);
if (displayName != null)
{
installedSoftware.Add(displayName.ToString());
}
}
}
}
}
return installedSoftware;
}
This is a 4.0 solution but will NOT work in 3.5
C#: How to get installing programs exactly like in control panel programs and features?
What am I missing?