Get List of Installed Software in Local Machine 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.