Friday, August 27, 2010

List Add/Remove Programs on Remote Computer

Quite a handy little script for listing programs showing as installed on a remote location without having to check the registry. Modify the computer name in the script. To output the file to a text file, run from dos with a >c:\output.txt command.

__________

On Error Resume Next

Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20

arrComputers = Array("COMPUTERNAMEHERE")
For Each strComputer In arrComputers
WScript.Echo
WScript.Echo "=========================================="
WScript.Echo "Computer: " & strComputer
WScript.Echo "=========================================="

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32Reg_AddRemovePrograms", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)

For Each objItem In colItems
WScript.Echo "DisplayName: " & objItem.DisplayName
WScript.Echo "InstallDate: " & objItem.InstallDate
WScript.Echo "ProdID: " & objItem.ProdID
WScript.Echo "Publisher: " & objItem.Publisher
WScript.Echo "Version: " & objItem.Version
WScript.Echo
Next
Next

________

0 comments:

Post a Comment