Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How to check the port status of multiple IP Addresses from windows command prompt. I am looking for some Batch file or a Dos SCRIPT. Can anyone help on this?

share|improve this question
    
You could probably do this with PortQry. Do you always need to check the same ports? UDP/TCP/Both? –  Bart De Vos Sep 8 '11 at 11:29
1  
PortQry is useful but how to make a batch script or portqry to read the host list from a txt file, exicute the command and send the result to -l log.txt file –  Sunil Reddy Sep 8 '11 at 14:21
    
Thnx all for the support, My requirement got solved by using PortQry. –  Sunil Reddy Sep 8 '11 at 16:01
    
i used the below in to the batch file. –  Sunil Reddy Sep 8 '11 at 16:02
    
set protocol=TCP set port#=8080,4343,18443 for /f "tokens=1" %%V in (hs.txt) do portqry -n %%V -p %protocol% -o %port#% –  Sunil Reddy Sep 8 '11 at 16:02
add comment

2 Answers

You could use nmap http://nmap.org to script something to check and list whats open on a given host or set of hosts

TiZon is right though, wed need to know more about what youre wanting to do before we could give a more concise answer.... Are you checking more than one host, the same ones over and over, more than one port, etc?

Just a wild assumption... If you want a robust monitoring and alerting system you could look at nagios www.nagios.org its free and does a great job monitoring and alerting for things like open / closed ports

share|improve this answer
    
Yes i am trying to find the status of multiple ports like 8080,4343 on multiple IP addresses i.e list of systems in a txt file. –  Sunil Reddy Sep 8 '11 at 13:18
add comment

I second nmap, but you can check for open connections with telnet

Telnet computer port

Such as:

telnet webserver1 80
share|improve this answer
    
i have to find the multiple port status for multiple IP address nearly about 400+ systems. I am looking for any simple batch script which can generate the status of port in to a log file. –  Sunil Reddy Sep 8 '11 at 13:31
    
This can be accomplished via a for loop given a list of servers, and at the end of the telnet command, append ">> filename.log" to the end of the command so that it appends the output to a file of your choosing (creating the logfile if it doesn't exist.) –  gWaldo Sep 8 '11 at 15:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.