Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I finally found a VB script via <a href="http://www.msfn.org/board/vbscript-ping-multiple-ip-addresses-and-machine-names-t104877.html" rel="nofollow noreferrer">here</a>. </p> <p>Basically, the script will retrieve a list of servers from servers.txt (this file contains the host names line by line) and generate a CSV file which contains comprehensive ping results of all servers.</p> <p><strong>NOTE</strong>: Do NOT name the script as 'ping.vbs' as it will use 'ping.vbs' to ping the hosts instead of 'ping' command.</p> <p>Here is the script:</p> <pre><code>Const ForReading = 1 Set objFSO = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("WScript.Shell") If not objFSO.FileExists("servers.txt") THEN wscript.echo "Please create a file named 'servers.txt' with one PC name to be pingedper line,"&amp;_ vbcrlf&amp;"with a hard return at the end of each line." wscript.quit end if tempobj="temp.txt" Set objTextFile = objFSO.OpenTextFile("servers.txt", ForReading) logfile="results.csv" Set ofile=objFSO.CreateTextFile(logfile,True) strText = objTextFile.ReadAll objTextFile.Close wscript.echo "Ping batch starting, please be patient. This could take some time to"&amp;_ vbcrlf&amp;"finish, depending on the number of hosts to check. You "_ &amp;"will be "&amp;vbcrlf&amp;"notified upon the completion of this script." ofile.WriteLine ","&amp;"Ping Report -- Date: " &amp; Now() &amp; vbCrLf arrComputers = Split(strText, vbCrLF) for each item in arrcomputers objShell.Run "cmd /c ping -n 1 -w 1000 " &amp; item &amp; " &gt;temp.txt", 0, True Set tempfile = objFSO.OpenTextFile(tempobj,ForReading) Do Until tempfile.AtEndOfStream temp=tempfile.readall striploc = InStr(temp,"[") If striploc=0 Then strip="" Else strip=Mid(temp,striploc,16) strip=Replace(strip,"[","") strip=Replace(strip,"]","") strip=Replace(strip,"w"," ") strip=Replace(strip," ","") End If If InStr(temp, "Reply from") Then ofile.writeline item &amp; ","&amp;strip&amp;","&amp;"Online." ElseIf InStr(temp, "Request timed out.") Then ofile.writeline item &amp;","&amp;strip&amp;","&amp;"No response (Offline)." ELSEIf InStr(temp, "try again") Then ofile.writeline item &amp; ","&amp;strip&amp;","&amp;"Unknown host (no DNS entry)." End If Loop Next tempfile.close objfso.deletefile(tempobj) ofile.writeline ofile.writeline ","&amp;"Ping batch complete "&amp;now() wscript.echo "Ping batch completed. The results will now be displayed." objShell.Run("""C:\YOUR OFFICE INSTALL PATH\Microsoft Office\Office10\excel.exe """&amp;logfile) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload