Script to list installed software and output to CSV

Reading Time: < 1 minute

The below script will output applications installed on a server/workstation to a CSV file.

Copy the below to a notepad file and name with a .vbs extention e.g. InstalledSoftware.vbs.

Amend the path on line 13 or leave as default. (Note, you may need to re enter the speech ( ” ) marks after copying the below code to a notepad 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 objShell = CreateObject(“WScript.Shell”)
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
strTemp = objShell.ExpandEnvironmentStrings(“%TEMP%”)
Set objFile = objFSO.CreateTextFile(“C:\Listsoftware.csv“,True)
Set objReg = GetObject(“winmgmts:{impersonationLevel=delegate}!//” & strComputer & _
 “/root/default:StdRegProv”)
objReg.EnumKey HKLM, strKey, arrSubkeys
 objFile.WriteLine VbCrLf & “Display Name,Install Date,Version,Estimated Size mb”
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
  bech=  strValue1 & “,”
  End If
  objReg.GetStringValue HKLM, strKey & strSubkey, _
   strEntry2, strValue2
  If strValue2 <> “” Then

   bech= bech & strValue2 & “,”
  End If
  objReg.GetDWORDValue HKLM, strKey & strSubkey, _
   strEntry3, intValue3
  objReg.GetDWORDValue HKLM, strKey & strSubkey, _
   strEntry4, intValue4
  If intValue3 <> “” Then
     bech= bech &  intValue3 & “.” & intValue4 & “,”
  End If
  objReg.GetDWORDValue HKLM, strKey & strSubkey, _
   strEntry5, intValue5
  If intValue5 <> “” Then
    bech= bech & Round(intValue5/1024, 3)
 objFile.WriteLine bech
  End If
Next
objFile.Close

Please follow and like us: