Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

test for open ports on remote computers

Status
Not open for further replies.

bfpnetadmin

IS-IT--Management
Jan 21, 2008
9
US
Hey all.

I need a vbs script or batch file that will telnet to a remote ip address and tell me whether port 1723 is up or down.

I have a RAS server and i'm creating a diagnostic that tests port numbers.

Please help.

 
You can download and use PUTTY and the batch file version PLINK to telnet. Both are free. You can google for them.

Basically PUTTY is the interactive version. You can try it by hand, save your session then use PLINK to run it in batch. You can send commands to PLINK via a text file.

I've used it to telnet into the MozREPL for Firefox and control a running instance of Firefox. Google for MozREPL if you're interested.

Here's a sample of script. It's not VBScript but similar and you should be able to translate it...

Code:
comspec = environment("COMSPEC")
runhidewait(comspec, "/c plink -raw -batch -P 4242 localhost < Google-Search.txt")

the contents of Google-Search.txt...

Code:
var q = content.document.getElementsByName("q")[0];
q.value = "Winbatch";
var b = content.document.getElementsByName("btnG")[0];
b.click();
repl.quit()

So it just calls the CMD interpreter, uses PLINK to connect to port 4242 on the localhost and then sends the commands from the file (Javascript).

You can capture output by just using redirection to another file...

Code:
comspec = environment("COMSPEC")
runhidewait(comspec, "/c plink -raw -batch -P 4242 localhost < Google-Search.txt > Output.txt")

>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top