fortypoundhead.com

Get a list of installed software

Posted On 2017-09-23 by VB6Boy
Keywords:
Tags: VBScript Windows
Views: 90


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 the Author

VB6Boy has posted a total of 22 articles.


Comments On This Post

No comments on this post yet!


Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.


Your IP address is:107.20.115.174

Before you can post, you need to prove you are human. If you log in, this test goes away.




Quick Links