none
how to search all installed and runnabke application in vb.net RRS feed

  • Question

  • how to list my all application like google chrome , vs2008, photoshop etc . which is installed on my computer?????????????????????????????????

    ____________________________________________ Everything is possible

    Wednesday, September 11, 2013 4:02 PM

Answers

  • Hi Gopal,

    There are many ways to achieve your goals. I pick up two of them for you.

    Iterating through the registry key "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" seems to give a comprehensive list of installed applications.

    Dim registry_key As String = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"

    Using key As Microsoft.Win32.RegistryKey = Registry.LocalMachine.OpenSubKey(registry_key)

                    For Each subkey_name As String In key.GetSubKeyNames()

                                    Using subkey As RegistryKey = key.OpenSubKey(subkey_name)

                                                    Console.WriteLine(subkey.GetValue("DisplayName"))

                                    End Using

                    Next

    End Using

    Alternatively, you could use WMI.

    Dim mos As New ManagementObjectSearcher("SELECT * FROM Win32_Product")

    For Each mo As ManagementObject In mos.[Get]()

                    Console.WriteLine(mo("Name"))

    Next

    But this is rather slower to execute, and I've heard it may only list programs installed under "ALLUSERS", though that may be incorrect. It also ignores the Windows components & updates, which may be handy for you.

    Best Regards,


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Thursday, September 12, 2013 4:25 AM
    Moderator

All replies

  • Hi Gopal,

    There are many ways to achieve your goals. I pick up two of them for you.

    Iterating through the registry key "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" seems to give a comprehensive list of installed applications.

    Dim registry_key As String = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"

    Using key As Microsoft.Win32.RegistryKey = Registry.LocalMachine.OpenSubKey(registry_key)

                    For Each subkey_name As String In key.GetSubKeyNames()

                                    Using subkey As RegistryKey = key.OpenSubKey(subkey_name)

                                                    Console.WriteLine(subkey.GetValue("DisplayName"))

                                    End Using

                    Next

    End Using

    Alternatively, you could use WMI.

    Dim mos As New ManagementObjectSearcher("SELECT * FROM Win32_Product")

    For Each mo As ManagementObject In mos.[Get]()

                    Console.WriteLine(mo("Name"))

    Next

    But this is rather slower to execute, and I've heard it may only list programs installed under "ALLUSERS", though that may be incorrect. It also ignores the Windows components & updates, which may be handy for you.

    Best Regards,


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Thursday, September 12, 2013 4:25 AM
    Moderator
  • but i want to add in list box but there are an error was occur

     Dim registry_key As String = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"

            Using key As Microsoft.Win32.RegistryKey = Registry.LocalMachine.OpenSubKey(registry_key)

                For Each subkey_name As String In key.GetSubKeyNames()

                    Using subkey As RegistryKey = key.OpenSubKey(subkey_name)

                        Console.WriteLine(subkey.GetValue("DisplayName"))
                       

    ListBox1.Items.Add(subkey.GetValue("DisplayName").ToString) ' error on this line

                    End Using

                Next

            End Using

    i use Vs2008


    ____________________________________________ Everything is possible

    Thursday, September 12, 2013 5:09 AM
  • Dim mos As New ManagementObjectSearcher("SELECT * FROM Win32_Product")

    For Each mo As ManagementObject In mos.[Get]()

                    Console.WriteLine(mo("Name"))

    Next

    this code is successfully run but google chrome , firefox was not listed ....

    please help me i want to list all program that user can run and work


     Everything is possible


    Thursday, September 12, 2013 11:23 AM