I need to ping one IP from multiple source IPs and write the results to a file or HTML page for the results. i need to get the results from all 4 pings to include TTL and how many of the 4 pings dropped and the ping time.
I know with a IPv6 you can use the -S trigger in the ping command to designate a source IP but how do you do it for a IPv4 environment.
Setup:
Windows 2003 server R2 Standard x64.
.txt file containing 85 IPv4 address i would like to use as the source IPs
1 target IPv4 address
will be run from one central server
will be logged in as admin on the central server
Desired result:
HTML page that displays the results grouped by source IP
Results to include all 4 ping reply times, TTL, total packets sent, total packets received and average ping time in ms
Now let me complicate things a bit. I am not in an environment that allows me to install any additional software that is not include in the windows 2003 server R2 standard x64 normal install. It has been ages since writing .bat files and my memory is still very weak on .bat files. All IP addresses are IPv4. While I do have FQDNs for all these servers I need to use IPs (for one reason or another)
I have the following to create the page desired and ping from one system to many but the rest is where I am having my problems since I need to ping from many to one, and the only results my script gives me is properly formatted html pages but it only says processing=done
Where have I gone wrong… please help…
Thank you
—edit— by changing ping to ping.exe and placing %%i in quotes – “%%i” now i get results but not in the nice format i was hoping for. it gives the results in the format of pining 127.0.0.1 with 32bytes of date: reply from …. as if was just outputing to a text file. what i would like it to do is show it in a table format. have made the changes to the code below.
@echo off
echo ^<HTML^>^<HEAD^><TITLE^>SERVER PING INFO^</TITLE^>^</HEAD^> >>ping-results.html
echo ^<BODY GBCOLOR=#FFFFFF” TEXT=”#000000” LINK+#0000FF” VLINK=#800080”^> >>ping-results.html
echo ^<p align="center"^>^<table border="1" width="600"^> >>ping-results.html
echo ^<tr^>^<td^>^<B^>ping results^</td^> >> ping-results.html
for /F %%i in (c:\ping-results\serverIP.txt) do (
echo Processing %%i...
ping.exe "%%i" > "c:\ping-results\%%i.html" /format:htable.xsl
echo ^<tr^>^<td^>%%i^</td^> >> ping-results.html
echo ^<td^>^<a href="c:\ping-results\%%i.html"^>Results^</a^>^</td^> >> ping-results.html
echo ^</tr^> >> ping-results.html
)
echo ^<p align="center"^>^<b^>^<font size="+1" color="Red"^>^<BR^>Completed at >> ping-results.html time /T >> ping-results.html
echo - on >> ping-results.html
date /T >> ping-results.html
echo ^</font^>^</b^>^<BR^>^</p^> >> ping-results.html
echo.
echo DONE!!
wouldnt it be best to run the ping command prior to building the html file?
like this (obvioulsy change the 127.0.0.1 to your server #)
now you can use the vars: pingrspn4-pingrspn7 in your “build an html file” script.
nice idea though on the build an html on the fly, i like it.
One question on the /format option on the ping line, i notice that ping does not have a /format parameter, so is the /format option coming from the redirect symbol?
[edit]
so i tweaked your file (you had some missing html code) to format the results (server.html) pages