Search Tools Links Login

Get a list of installed software


It's always good to perform an inventory of workstations you might be responsible for. This doesn't mean just writing down make, model and serial number. You need a list of software installed on those machines as well.

Using VBScript, you can easily get a list of the installed software on a local or remote workstation, along with other information about each package, such as install date, version, size, and more.

The script below will utilize the Windows Registry to get the list of installed software. Note that if you want to query remote machines, the account you are running this under must have the necessary permissions on the remote workstation.

Also note that you won't want to run this by simply double-clicking the .vbs file. Rather, you will want to open a command prompt, and type:

cscript GetInstalledSoftware.vbs

Be sure to replace GetInstalledSoftware.vbs with whatever you name the file.

Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
strComputer = "."
strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
strEntry1a = "DisplayName"
strEntry1b = "QuietDisplayName"
strEntry2 = "InstallDate"
strEntry3 = "VersionMajor"
strEntry4 = "VersionMinor"
strEntry5 = "EstimatedSize"

Set objReg = GetObject("winmgmts://" & strComputer & "/root/default:StdRegProv")
objReg.EnumKey HKLM, strKey, arrSubkeys
WScript.Echo "Installed Applications" & VbCrLf

For Each strSubkey In arrSubkeys
  intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, strEntry1a, strValue1)

  If intRet1 <> 0 Then
    objReg.GetStringValue HKLM, strKey & strSubkey, strEntry1b, strValue1
  End If

  If strValue1 <> "" Then
    WScript.Echo VbCrLf & "Display Name: " & strValue1
  End If

  objReg.GetStringValue HKLM, strKey & strSubkey, strEntry2, strValue2

  If strValue2 <> "" Then
    WScript.Echo "Install Date: " & strValue2
  End If

  objReg.GetDWORDValue HKLM, strKey & strSubkey, strEntry3, intValue3
  objReg.GetDWORDValue HKLM, strKey & strSubkey, strEntry4, intValue4

  If intValue3 <> "" Then
    WScript.Echo "Version: " & intValue3 & "." & intValue4
  End If

  objReg.GetDWORDValue HKLM, strKey & strSubkey, strEntry5, intValue5

  If intValue5 <> "" Then
    WScript.Echo "Estimated Size: " & Round(intValue5/1024, 3) & " megabytes"
  End If
Next

About this post

Posted: 2017-09-23
By: vb6boy
Viewed: 882 times

Categories

Visual Basic Script (VBS)

Windows

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.