This Vbs script will take a machine name as specified by the Input Box and enumerate all of the applications found in the Win32_Product class and send the information to an Excel spreadsheet.
Note: The Win32_Product class only lists software that was installed with Windows Installer.
Vbs Script:
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
intRow = 2
objExcel.Cells(1, 1).Value = "Name"
objExcel.Cells(1, 2).Value = "Caption"
objExcel.Cells(1, 3).Value = "Description"
objExcel.Cells(1, 4).Value = "Vendor"
objExcel.Cells(1, 5).Value = "Version"
objExcel.Cells(1, 6).Value = "Identifying Number"
objExcel.Cells(1, 7).Value = "Install Location"
strComputer = InputBox ("Enter Machine Name")
On Error Resume Next
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Product")
For Each objItem in colItems
Do
objExcel.Cells(intRow, 1).Value = objItem.Name
objExcel.Cells(intRow, 2).Value = objItem.Caption
objExcel.Cells(intRow, 3).Value = objItem.Description
objExcel.Cells(intRow, 4).Value = objItem.Vendor
objExcel.Cells(intRow, 5).Value = objItem.Version
objExcel.Cells(intRow, 6).Value = objItem.IdentifyingNumber
objExcel.Cells(intRow, 7).Value = objItem.InstallLocation
Loop Until objRecordset.EOF
intRow = intRow + 1
Next
objExcel.Range("A1:G1").Select
objExcel.Selection.Interior.ColorIndex = 19
objExcel.Selection.Font.ColorIndex = 11
objExcel.Selection.Font.Bold = True
objExcel.Cells.EntireColumn.AutoFit
Wscript.Echo "Done"
No Comments