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"));
                  }
            }
      }
}

Published Wednesday, September 24, 2003 2:27 AM by RoyOsherove
Filed under:

Comments

Tuesday, September 23, 2003 7:47 PM by Jeffrey E. Moeller

# re: Getting the list of installed programs on the local machine

Hi, you inspired me to try my first windows application.

I created a C# windows application, dragged a button on the form and put your function guts in the button click function.

There were a number of errors in 1.1

the first being:
Cannot implicitly convert type '<error>' to 'System.IDisposable'

Any ideas?
thanks, Jeff
Tuesday, September 23, 2003 8:35 PM by Jamie Cansdale

# re: Getting the list of installed programs on the local machine

I'll show you mine, if you show me yours... ;)
Tuesday, September 23, 2003 10:55 PM by SBC

# re: Getting the list of installed programs on the local machine

Note the following in the code (it's a console app)

using Microsoft.Win32; // needed namespace

Call Class1.GetInstalled() in the Main as it's a static call

Put Console.ReadLine() at the end so that the console window stays stationary to read output.

Good little app...
Wednesday, September 24, 2003 8:58 AM by Alexandre Rocco

# re: Getting the list of installed programs on the local machine

Nice snippet, just added a check to see if sk.GetValue("DisplayName") is null so I do not display some entries that is not related to the list! :)

--Alexandre
Wednesday, September 24, 2003 12:04 PM by Roy Osherove

# re: Getting the list of installed programs on the local machine

Good thinking, Alexandre!
Sunday, April 18, 2004 10:40 PM by roccolocko

# Get information of software installed

I would like to know if its posible to get the information of software installed on my PC, I have a code in vb .NET to get the installed software or programs, but i dont know how to get information about these. Like product-key, disk space, instalation date, etc, etc...
I dont know if you could help me with this...
Thanks
Thursday, May 06, 2004 11:48 AM by Dave

# re: Getting the list of installed programs on the local machine

roccolocko,

Where can I find this VB.NET code to get the list of installed programs?

Thanks
Sunday, June 27, 2004 2:15 AM by Franz Kiermaier

# re: Getting the list of installed programs on the local machine

Hello,
thank you for this code snippet.
This was very helpful for developing my application.

Franz
Monday, July 19, 2004 2:10 AM by abdullah

# re: Getting the list of installed programs on the local machine

Plz ...Can Any one help me....


Can I get the installed software on a remote machince....(I can ping that machine)...



thanks in advance.....
Friday, April 18, 2008 2:12 PM by cannot implicitly convert type string to system uri

# cannot implicitly convert type string to system uri

Pingback from  cannot implicitly convert type string to system uri