Click here to Skip to main content
15,907,497 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have been working on the below code now for about 2 days and i cant seem to get it to read every registry key to show me all the software installed on a local seat or a remote seat. I dont get any errors and it will complete and show me a majority of the software installed but i will still be missing 5 to 10 items. If someone can please show me what i m doing wrong that would be great. I have tried pulling from both the 64 bit location and 32 bit location.

VB
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    SoftwareInformationRegistry(TextBox1.Text)
End Sub

Public Sub SoftwareInformationRegistry(ByVal strComputer As String)

    Dim objLocator, objService, objRegistry, arrIdentityCode, strIdentityCode, objShell
    Dim strRegIdentityCodes As String

    objLocator = CreateObject("WbemScripting.SWbemLocator")


    Try

        objService = objLocator.ConnectServer(strComputer, "Root\Default")
        objRegistry = objService.Get("StdRegProv")

    Catch ex As Exception
        MsgBox("Unable to connect")
        Exit Sub
    End Try


    'strRegIdentityCodes = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
    strRegIdentityCodes = "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"

    Const HKLM = &H80000002

    Dim strRegIdentityInfo, strDisplayName, strDisplayVersion, strInstallDate, strUninstallString, strPublisher

    objRegistry.EnumKey(HKLM, strRegIdentityCodes, arrIdentityCode)
    objShell = CreateObject("WScript.Shell")

    For Each strIdentityCode In arrIdentityCode

        Try

            strRegIdentityInfo = "HKEY_LOCAL_MACHINE\" & strRegIdentityCodes & "\" & strIdentityCode & "\"
            strDisplayName = objShell.RegRead(strRegIdentityInfo & "DisplayName")
            strDisplayVersion = objShell.RegRead(strRegIdentityInfo & "DisplayVersion")
            strInstallDate = InstallDate(objShell.RegRead(strRegIdentityInfo & "InstallDate"))
            strUninstallString = objShell.RegRead(strRegIdentityInfo & "UninstallString")
            strPublisher = objShell.RegRead(strRegIdentityInfo & "Publisher")


            ListView1.Items.Add(strDisplayName)

        Catch ex As Exception

            Continue For
        End Try

    Next

End Sub

Private Function InstallDate(ByVal strDate As String) As String

    Try

        Dim YY, MM, DD As String

        YY = strDate.Substring(0, 4)
        MM = strDate.Substring(4, 2)
        DD = strDate.Substring(6, 2)

        Return DD & "-" & MM & "-" & YY

    Catch ex As Exception

    End Try

End Function
Posted
Comments
Christian Graus 27-Jul-12 17:15pm    
Are you saying it misses 5-10 that appear in the add/remove list ?
lewax00 27-Jul-12 17:39pm    
Have you manually checked the registry and verified that all programs are listed in those keys?
Zachary.shupp 27-Jul-12 17:52pm    
Yes all the programs are listed ivn the registry and are displayed in add remove programs for some odd reason i cant get them to show up
lewax00 27-Jul-12 17:54pm    
Try having the program look in HKEY_CURRENT_USER as well, I see some listed there on my machine.
Zachary.shupp 27-Jul-12 18:02pm    
I have tried that area because we do have some there too. My biggest issue is that im looking in the registry n its not diplaying information on all the folders that are under the uninstall registry section.

1 solution

Browsing through your code in a little more detail, I realized you might have better luck with the Registry[^] class.
 
Share this answer
 
Comments
Kenneth Haugland 27-Jul-12 18:26pm    
A 5 to you for that

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900