miteshlad2003
Technical User
Dear tektips,
I am trying to put together a script that will read in a list of servers from a text file and the script will then go away and ping all the servers in the list. If servers are online it will output this into a successful file and if it receives a time out it will place the servers in a failed text file.
I am hoever having problems running the ping command. Below is what i have written so far, but i am having problems getting the ping command to fire and read from the server list.
any help would be a great help
Code so far:
Dim oShell
Set oShell = WScript.CreateObject ("WSCript.shell")
oShell.run "cmd /c ping"
Set oShell = Nothing
Sub ReadServerData()
'Opening a file for reading
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\test\inputserverfile.txt", 1)
Do Until objFile.AtEndOfStream
ServerVariable = objFile.ReadLine
oShell.run ServerVariable
Wscript.Echo & ServerVariable
Wscript.Echo "Got Here!!"
Loop
objFile.Close
End Sub
thanks
Mitesh
I am trying to put together a script that will read in a list of servers from a text file and the script will then go away and ping all the servers in the list. If servers are online it will output this into a successful file and if it receives a time out it will place the servers in a failed text file.
I am hoever having problems running the ping command. Below is what i have written so far, but i am having problems getting the ping command to fire and read from the server list.
any help would be a great help
Code so far:
Dim oShell
Set oShell = WScript.CreateObject ("WSCript.shell")
oShell.run "cmd /c ping"
Set oShell = Nothing
Sub ReadServerData()
'Opening a file for reading
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\test\inputserverfile.txt", 1)
Do Until objFile.AtEndOfStream
ServerVariable = objFile.ReadLine
oShell.run ServerVariable
Wscript.Echo & ServerVariable
Wscript.Echo "Got Here!!"
Loop
objFile.Close
End Sub
thanks
Mitesh