Determine network problems – only log ping dropouts – Pingtest.bat

A ping log file to create is not so easy. We have created the solution for this and a short script , which we want to introduce to you here today.

Network problems can really take the nerve off every admin. Problems that arise are sometimes very difficult to localize. The best known and most popular tool is the “Ping” command , a tool that the user can use to check whether and how quickly a device can be contacted in the network.

However, if the user runs the ping with the “-t” parameter , the ping runs endlessly . This leads to a full command prompt window relatively quickly and the user cannot do this really well, because he has to watch almost permanently. Of course you can also redirect the output to a text file , but this is also relatively cumbersome, because the file gets so long in a short time that the user loses the overview and can find ping dropouts very cumbersome .

That is why I have created a small script in which only the ping dropouts are displayed in a dos box and the ping errors are also logged in a text file . In addition, the time of the failure is also logged, as you can see below.

Ping error

After starting the batch file , you will be asked to enter the IP address or the DNS name . Then every dropout is logged until you simply close the window again.

The batch file looks like this:

Pingtest.bat source code

You can download the source code for this at the end of this article as a batch file.

The ping test script currently creates a file in the directory C: Temp with the IP address + file extension “.TXT . It is a pure text file and can be easily opened and edited with Notepad or with Excel . With different language versions of Windows, the ping test script must be adapted, since it is currently only designed for the German Windows versions. is. The text “do not exceed” must then be replaced by the appropriate translation.

Now a few explanations about the ping test or ping in general. Ping is a tool with which the user can check whether a certain computer can be reached in his IP network. The program was developed in 1983 and has always been part of the basic version of the Windows versions . It is a command line command which is best executed directly from a DOS prompt . The ping command has numerous parameters , which we would like to briefly list below:

Ping call parameters

Syntax: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS] [-r count] [-s count] [[-j host -list] | [-k host-list]] [-w timeout] [-R] [-S srcaddr] [-c compartment] [-p] [-4] [-6] Destination name

Options:

parameter description
-t Ping the specified host until the process ends . Press CTRL + BREAK to view the statistics and continue. Press CTRL + C to cancel the process.
-a Resolves addresses to host names .
-n count The number of echo requests to send .
-l size The size of the send buffer .
-f Sets the flag for ” Don’t fragment ” in the packet (IPv4 only).
-i TTL The lifespan.
-v TOS The service type (IPv4 only. This setting is out of date and has no effect on the service type field in the IP header).
-r count Record route for number of hops (IPv4 only).
-s count Time stamp for number of hops (IPv4 only).
-j host-list Loose source route ” according Host List (IPv4 only).
-k host-list Strict Source Route ” according to host list (IPv4 only).
-w timeout Time limit in milliseconds for each response.
-R Uses the routing header to also test the reverse route (IPv6 only).
This routing header is no longer used (see RFC 5095). In some systems,  echo requests are discarded when this header is used.
-s srcaddr The source address to use .
c compartment Routing depot identifier
-p Ping the address of a provider for Hyper-V network virtualization  .
-4 Forces the use of IPv4 .
-6 Forces the use of IPv6 .

With a ping or this ping test , data packets are sent to any computer in the network. It does not matter or the IP address or a computer name is specified as a parameter . A prerequisite for the computer name is of course a functioning DNS (Domain Name Service) . The ping program then measures the time until the host’s response arrives. The time then expresses how long a data packet takes to the host and back again. That is the ” response time average “. From the ping times , the user can then see how fast, high-performance and stable the network connection to the host is. If the user does not get a ping back, something is wrong with the routing between the 2 end points.

In the case of a host that has activated the internal Windows firewall , ping or the ping test generally does not return times because the firewall prevents communication. Then there is only the possibility to switch off the firewall on the host or to enable file and printer sharing ” in the firewall , then the ping or ping test works again.

Here you can download the batch file “PingTest.bat” . You still have to rename the file from PingTest.tx t to PingTest.bat after the download .

  • Download PingTest.bat

In another post on ” Ping Test and Diagnostic Tool ” we published further information on ping. You can also see your own IP address below:

164.68.104.131, 99.82.163.70

If you are still interested in other interesting articles on the topic of networking, please take a look at the following articles here on Windows FAQ.

– Reset network in Windows 10
– Teaming of network cards and performance problems
– Windows system error 1231 – The network address cannot be reached
– Network inventory
– Network performance in 10GBit networks

– Teaming of network cards – Hyper-V settings
– Hyper-V error when configuring the network on “q1”

Using network printer without joining a domain – Displaying network cards information with Adapterwatch

administrator