VBscript to get list of add remove progams with product code install date

There are many tools like SMS /SCCM or scripting to get list of applications installed on computers(you dont use SMS/SCCM only for this kind of information 🙂 ) but what if the clients are not reported back to site server for some other reason and there could lot of applications installed on computers then you will start troubleshooting the clients why it doesnt report.

 Use the below simple VB script to get list of applications installed on target computers with its installed date and product ID as well.

Collect list of computers that you are looking for and pipe all the computer names into computers.txt file.

create a notepad file and name it as applications.vbs and paste the following query into it.

Output will be piped into status.csv file on the same location where the VBscript runs from.

On Error Resume Next
Set fso=CreateObject("scripting.filesystemobject")
Set objinputfile=fso.OpenTextFile("computers.txt",1,true)
Set objoutputfile=fso.OpenTextFile("status.csv",2,true)
Do While objinputfile.AtEndOfLine <> True
strcomputer=objinputfile.ReadLine
 Set objWMIService = GetObject("winmgmts:\\" & strComputer)
 If Err.Number <> 0 Then
  objoutputfile.WriteLine( strcomputer & " " & Err.Description)
  Err.Clear
  Else
                              Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Product",,48)
objoutputfile.WriteLine ("computer name:" & strcomputer)
For Each objItem in colItems
   objoutputfile.WriteLine("Name: " & objItem.Name  & " , " & "ProductID: " & objItem.ProductID & "," &"Installed On:" & objItem.InstallDate )

Next
End if
Loop
msgbox("done")

PS:Both the computers file and VB script should be in same folder location.

 

2 Responses to "VBscript to get list of add remove progams with product code install date"

  1. I am getting error when running this script, can you please help me.
    error:
    Line:2
    Char:23
    Error: Invalid Character
    Source: Ms VBScript compilation error

    Reply

Post Comment