titaniumx5
MIS
Please Help
This is what I need to accomplish: there is a text file that contains a list of servers,I need to be able to read the text file (1 line at a time), ping the name, print the results to a file. This is what I have so far.. I can read (the first line) .. ping the name..print it to file.. now what I cannot figure out is how to have it continue to read line by line, ping, and print to file until the end of the file. Please help
Dim Shell
Dim PingExec
Dim PingOutput
Dim Wshshell
Dim SystemPath
Dim Result
Dim Server
SystemPath="C:\winnt\system32"
'set shell = server.createobject("wscript.shell"
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject"
Set objTextFile = objFSO.OpenTextFile _
("c:\arcascripts\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
This is what I need to accomplish: there is a text file that contains a list of servers,I need to be able to read the text file (1 line at a time), ping the name, print the results to a file. This is what I have so far.. I can read (the first line) .. ping the name..print it to file.. now what I cannot figure out is how to have it continue to read line by line, ping, and print to file until the end of the file. Please help
Dim Shell
Dim PingExec
Dim PingOutput
Dim Wshshell
Dim SystemPath
Dim Result
Dim Server
SystemPath="C:\winnt\system32"
'set shell = server.createobject("wscript.shell"
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject"
Set objTextFile = objFSO.OpenTextFile _
("c:\arcascripts\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