Skip to main content

Installed Software List on Remote Machine using WMI

Public Sub SoftwareInformationVBS(ByVal strComputer As String, ByVal strUserName As String, ByVal strPwd As String)

        Dim objWMIService, objFSO, objTextFile, colSoftware, objSoftware, objSWbemLocator

        Try

            objFSO = CreateObject("Scripting.FileSystemObject")
            objTextFile = objFSO.CreateTextFile("c:\software.txt", True)

            objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")

            If (strComputer = Environment.MachineName.ToString) Then

                objWMIService = objSWbemLocator.ConnectServer(strComputer, "root\cimv2")
            Else
                objWMIService = objSWbemLocator.ConnectServer(strComputer, "root\cimv2", strUserName, strPwd)
            End If

            objWMIService.Security_.ImpersonationLevel = 3

            colSoftware = objWMIService.ExecQuery("Select * from Win32_Product")
            objTextFile.WriteLine("Caption" & vbTab & _
                "Description" & vbTab & "Identifying Number" & vbTab & _
                "Install Date" & vbTab & "Install Location" & vbTab & _
                "Install State" & vbTab & "Name" & vbTab & _
                "Package Cache" & vbTab & "SKU Number" & vbTab & "Vendor" & vbTab _
                    & "Version")
            For Each objSoftware In colSoftware
                objTextFile.WriteLine(objSoftware.Caption & vbTab & _
                objSoftware.Description & vbTab & _
                objSoftware.IdentifyingNumber & vbTab & _
                objSoftware.InstallDate2 & vbTab & _
                objSoftware.InstallLocation & vbTab & _
                objSoftware.InstallState & vbTab & _
                objSoftware.Name & vbTab & _
                objSoftware.PackageCache & vbTab & _
                objSoftware.SKUNumber & vbTab & _
                objSoftware.Vendor & vbTab & _
                objSoftware.Version)
            Next
            objTextFile.Close()

        Catch ex As Exception

        End Try
        
End Sub

Popular posts from this blog

Ping Network Computer in VB.Net

"Ping" is very basic utility for every network programmer. Here we will discuss ping a computer in Network using VB.Net. We have two methods for pinging a computer. Method 1: Here we will use VB.Net NetworkInformation NameSpace. Public Sub PingStatus(ByVal strComputer As String) Dim pingSender As Ping = New Ping() Dim options As PingOptions = New PingOptions() options.DontFragment = True 'Create a buffer of 32 bytes of data to be transmitted Dim data As String = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" Dim buffer As Byte() = Encoding.ASCII.GetBytes(data) Dim timeout As Integer = 120 Dim reply As PingReply = pingSender.Send(strComputer, timeout, buffer, options) If (reply.Status = IPStatus.Success) Then MessageBox.Show("Ping Successed.") Else MessageBox.Show("Ping Faild.") End If End Sub Method 2: Here we are using .Net inbuil

GridView Paging and Sorting

Introduction Paging and Sorting are most commonly used features of ASP.Net GridView. And it is very easy to implement in GridView with small lines of code. Here I am going to demonstrate how to use Paging and Sorting in GridView for better use of data display.