NetNodeMan
Technical User
I have the following code which I want to use to ping a number of servers:
What I actually want to do is to run a srvinfo rather than a ping. The result of this srvinfo would then be written to a file which would be updated each day i.e. the log file would have a daily timestamp on it. I have this working for one server and it writes to Ping.txt but how do I do this for multiple servers and multiple outputs?
Thanks in advance.
Dim Shell, PingExec, PingOutput,Wshshell, SystemPath, Result, Server
SystemPath="C:\winnt\system32"
'set shell = server.createobject("wscript.shell")
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
("c:\srvinfo\test.txt", ForReading, True)
server = objTextFile.ReadLine
Set oShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
oShell.Run "command /C ping.exe " & Server & "> Ping.txt"
Wscript.echo Result
Wscript.Echo server
objTextFile.close
Wscript.Quit
What I actually want to do is to run a srvinfo rather than a ping. The result of this srvinfo would then be written to a file which would be updated each day i.e. the log file would have a daily timestamp on it. I have this working for one server and it writes to Ping.txt but how do I do this for multiple servers and multiple outputs?
Thanks in advance.