Blog

Get List of Installed Software in Local Machine using C# Code

By Priti Kumari Blogs | Windows Forms C# Jan 07, 2014
In this blog I will explain how to get the list of installed software using C# code.

Here, I will explain how to get the list of installed software in a local machine.

Step 1: Drag and drop Listbox control to Window Forms form and also drag and drop Label control on to  the form.


 
Step 2: For this you need to add the following NameSpace in your code.
 
using Microsoft.Win32;

Step 3: Then Add this code 

public void GetInstalledApps()  

{  

   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))  

           {  

               try  

               {    

                  listBox1.Items.Add(sk.GetValue("DisplayName"));                             

               }  

               catch (Exception ex)  

               { }  

           }  

       }  

       label1.Text = listBox1.Items.Count.ToString();  

   }  

}   

Step 4: Then Call This method in the Window Forms Constructor.

public Form1()  

{  

  InitializeComponent();  

  //Call this GetInstalledApps in Window Forms Constructor.  

  GetInstalledApps();  

}  


Step 5: Run your application and see that the output looks like this and also observe the number of software installed in your local machine.


COMMENT USING

PREMIUM SPONSORS

Hire Mobile & Web Developer on demand. 100% satisfaction. Try for 1 week or Money Back. Local and remote developers available all over USA.

Latest Blogs