Roy Osherove

View Original

Getting the list of installed programs on the local machine

Here's a snippet from the win-tech-off-topic list:

Getting the list of installed programs on the local machine:

 static void GetInstalled()
{
      string uninstallKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
      using (RegistryKey rk = Registry.LocalMachine.OpenSubKey(uninstallKey))
      {
            foreach (string skName in rk.GetSubKeyNames())
            {
                  using (RegistryKey sk = rk.OpenSubKey(skName))
                  {
                        Console.WriteLine(sk.GetValue("DisplayName"));
                  }
            }
      }
}