Connectivity to Dc´s


You need PORTQRY and a txt file to enter the hostnames of the servers or IPs.
Just copy the script below and save it as batch file.

Enjoy.

:::::::::::::::::::::::::::: BEGIN SCRIPT :::::::::::::::::::::::::

@ECHO OFF
:: Test connectivity.
:: using PORTQRY utility.
:: The SERVERS.TXT contains a list of servers (one server per line)
:: to check connectivity to.
ECHO     DATE: %DATE% > PORTQRY_%COMPUTERNAME%.TXT
ECHO     TIME: %TIME% >> PORTQRY_%COMPUTERNAME%.TXT
ECHO     USER: %USERNAME% >> PORTQRY_%COMPUTERNAME%.TXT
ECHO COMPUTER: %COMPUTERNAME% >> PORTQRY_%COMPUTERNAME%.TXT
ECHO. >> PORTQRY_%COMPUTERNAME%.TXT
ECHO. >> PORTQRY_%COMPUTERNAME%.TXT
ECHO. >> PORTQRY_%COMPUTERNAME%.TXT
FOR /F “tokens=1” %%i in (servers.txt) DO (
ECHO ::::::::::::::::::::::  %%i  :::::::::::::::::::::::::: >> PORTQRY_%COMPUTERNAME%.TXT
ECHO Testing %%i
ECHO. >> PORTQRY_%COMPUTERNAME%.TXT
PORTQRY -n %%i -e 88 -p TCP | findstr /i “88”  >> PORTQRY_%COMPUTERNAME%.TXT
PORTQRY -n %%i -e 53 -p TCP | findstr /i “53” >> PORTQRY_%COMPUTERNAME%.TXT
PORTQRY -n %%i -e 137 -p TCP | findstr /i “137” >> PORTQRY_%COMPUTERNAME%.TXT
PORTQRY -n %%i -e 138 -p TCP | findstr /i “138” >> PORTQRY_%COMPUTERNAME%.TXT
PORTQRY -n %%i -e 139 -p TCP | findstr /i “139” >> PORTQRY_%COMPUTERNAME%.TXT
PORTQRY -n %%i -e 445 -p TCP | findstr /i “445” >> PORTQRY_%COMPUTERNAME%.TXT
PORTQRY -n %%i -e 389 -p TCP | findstr /i “389” >> PORTQRY_%COMPUTERNAME%.TXT
PORTQRY -n %%i -e 3268 -p TCP | findstr /i “3268”  >> PORTQRY_%COMPUTERNAME%.TXT
PORTQRY -n %%i -e 3269 -p TCP | findstr /i “3269” >> PORTQRY_%COMPUTERNAME%.TXT

ECHO. >> PORTQRY_%COMPUTERNAME%.TXT
ECHO. >> PORTQRY_%COMPUTERNAME%.TXT
)

:::::::::::::::::::::::: END SCRIPT :::::::::::::::::::::::::

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s