Click here to Skip to main content
15,886,110 members
Articles / Programming Languages / Visual Basic

Software's List Installed on Windows Machine

Rate me:
Please Sign up or sign in to vote.
2.18/5 (14 votes)
30 Sep 2008CPOL1 min read 61.4K   1.2K   28   8
This program gets the list of softwares installed on Windows running machine

Introduction

Many of us don't know what softwares are installed and strive to check them programatically. Here's a simple way to get that list. This is very useful when you want to create an installer for your projects, which helps you in checking the right version of minimal software requirements for your projects on clients' machine. 

Background

There's no complicated code in this. If you have basic knowledge of Windows Registry, that's enough. But be sure you make a backup of your registry before doing anything with it as that is a good and safe way of programming. 

Using the Code

I have taken a simple Console Application in C#, created an object for registry accessing the right path, i.e. SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall.

This registry path has all the list of softwares installed on your machine. Following is the code to achieve it in C#.

In C#

C#
class Program
    {
        static void Main(string[] args)
        {
          // Do back up of ur registry before running it.
          //Registry path which has information of all the softwares installed on machine
            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))
                    {
                        // we have many attributes other than these which are useful.
                        Console.WriteLine(sk.GetValue("DisplayName") + 
				"  " + sk.GetValue("DisplayVersion"));
                    }
                    
                }
            }
            Console.ReadLine(); // To make the o/p readable.
        }        
    }	

In VB.NET

VB.NET
Imports System 
Imports System.Collections.Generic 
Imports System.Text 
Imports Microsoft.Win32 

Namespace SEList 
    Class Program 
        Private Shared Sub Main(args As String()) 
           ' Do back up of ur registry before running it. 
           'Registry path which has information of all the softwares installed on machine 
       Dim uninstallKey As String = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" 
            Using rk As RegistryKey = Registry.LocalMachine.OpenSubKey(uninstallKey) 
                For Each skName As String In rk.GetSubKeyNames() 
                    Using sk As RegistryKey = rk.OpenSubKey(skName) 
                        ' we have many attributes other than these which are useful. 
     Console.WriteLine(sk.GetValue("DisplayName") + " " + sk.GetValue("DisplayVersion")) 
                   
        End Using 
         Next 
        End Using 
        Console.ReadLine() ' To make the o/p readable. 
        End Sub 
    End Class 
End Namespace	 

output.jpg

Points of Interest

This code snippet is handy for developers working on creating installers for projects, which gives them flexibility to check the correct version of software installed on client machine to avoid confusion later. It's a good way of creating the installers. This is useful for all kinds of applications developed in Microsoft .NET environment.

History

  • 30th September 2008: Initial post

This is my first article on CodeProject. Hope to post more useful code snippets in future. Leave me your suggestions and comments as these are the things which boost us and help us in giving more relevant and error free code snippets.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralMy vote of 1 Pin
programmerdon28-Aug-12 5:03
programmerdon28-Aug-12 5:03 
QuestionGet the info of how long Software running on Windows Machine Pin
Ananthikasivel27-Feb-12 22:33
Ananthikasivel27-Feb-12 22:33 
GeneralThanks Pin
RavinderSingroha15-May-09 2:02
RavinderSingroha15-May-09 2:02 
QuestionIs using the uninstall registry the perfect solution? Pin
lwiji-tn4-Mar-09 2:08
lwiji-tn4-Mar-09 2:08 
GeneralGet more information from the registry... Pin
Paw Jershauge30-Sep-08 10:28
Paw Jershauge30-Sep-08 10:28 
QuestionRe: Get more information from the registry... Pin
logiCode4-Oct-08 8:26
logiCode4-Oct-08 8:26 
AnswerRe: Get more information from the registry... Pin
Paw Jershauge5-Oct-08 21:12
Paw Jershauge5-Oct-08 21:12 
General[Message Removed] Pin
ped2ped30-Sep-08 3:31
ped2ped30-Sep-08 3:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.