I need a script

Not being that familar with scripts, I look to the experts for advice.  I need a script that will report a file version on a number of servers.  I have the following script that works well, but I have to OK through each server.  I would like to to output the results in a list or some kind of file.  

WScript.Echo "Server name" & vbTab & "File Version"
'WScript.Echo "-----------" & vbTab & "-----------------"

Const ForReading = 1
Set objDictionary = CreateObject("Scripting.Dictionary")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("C:\servers.txt", ForReading)
i = 0
Do Until objTextFile.AtEndOfStream
   strNextLine = objTextFile.Readline
   objDictionary.Add i, strNextLine
   i = i + 1
Loop
For Each objItem in objDictionary
   Set objFSO = CreateObject("Scripting.FileSystemObject")
   Wscript.Echo objDictionary.Item(objItem) & vbTab & objFSO.GetFileVersion _
("\\"& objDictionary.Item(objItem) & "\C$\Program Files\application\file.exe")                  

Next



Thanks
mchristo63Asked:
Who is Participating?
 
fulscherConnect With a Mentor Commented:
The following is not tested, you may need to work a bit on it:

WScript.Echo "Server name" & vbTab & "File Version"
'WScript.Echo "-----------" & vbTab & "-----------------"

Const ForReading = 1
Const ForWriting = 2

Set objDictionary = CreateObject("Scripting.Dictionary")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("C:\servers.txt", ForReading)
Set objReportFile = objFSO.OpenTextFile("C:\report.txt", ForWriting)

i = 0
Do Until objTextFile.AtEndOfStream
   strNextLine = objTextFile.Readline
   objDictionary.Add i, strNextLine
   i = i + 1
Loop
For Each objItem in objDictionary
   Set objFSO = CreateObject("Scripting.FileSystemObject")
   objReportFile.WriteLine objDictionary.Item(objItem) & vbTab & objFSO.GetFileVersion _
("\\"& objDictionary.Item(objItem) & "\C$\Program Files\application\file.exe")                  

Next
0
 
fulscherCommented:
Ups - an explanation: This creates a file C:\report.txt (erases it if it is not empty) and writes your report into that file.
Hope this helps
J
0
 
mchristo63Author Commented:
Excellent!
0
 
fulscherCommented:
Thank you!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.