Ping Servers in DMZ



Let’s say in a situation you need to check the connectivity of few servers in DMZ from your management server.



Scenario: You have 20 Servers running in your DMZ network. You need to check connectivity of these servers everyday or once a week to make sure they are up and running. The manual process would be:

1. From your working computer you log on to your Management Server from which you can ping these servers. You use RDP to connect to Management server.




2. Ping each_server and get response from Management Box.

To avoid manual process you can use PSEXEC from
http://www.sysinternals.com/ to do so.

This is how you do it:

You know these servers are in DMZ and can be pinged only from Management Server. You use a simple script to do so:

For one server you can use the following:

PSEXEC
\\management_server ping server_in_dmz > c:\PingResponse\Response.txt

For more than one server you use the following:

1. A server.txt file to put all the servers in it.
2. A CMD or BAT file to ping all the servers and store their result in %server_name%.txt file.

***Start***

@echo off
Check Servers Ping Response in DMZ network.

set srvlist=servers.txt
rem ———————————–

cls
echo.if not exist “%srvlist% (
echo Can’t find Server List file: %srvlist%
pause>nul
goto:EOF
)

echo Processing all Servers……….
echo.
for /f “tokens=* delims=AU” %%m in (%srvlist%) do call:checknow “%%m”

goto:EOF

:checknow

set srvname=%~1set srvname=%srvname: =%
psexec.exe \\management_server ping -w 1000 %srvname% > C:\PingResponse\%srvname%.txt

goto:EOF

:eof

***End***



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>