views:

449

answers:

1

I want to write an app to test whether a Windows machine is responding correctly to RDP (Remote Desktop) - i.e. to check if the machine not only allows the connection, but is also responding normally, and is not hung or otherwise responding abnormally.

Is there a library or utility that I can use to do this? My searches turned up full RDC clients, but I'm hoping there's something out there at least offers an API for testing. I would most like to use Java or a scripting language to do this, but I'm open to suggestions.

A: 

Found this on Expert Sexchange:

use Net::Telnet ();
$t = new Net::Telnet (Timeout => 10, Prompt => '', Port >= 3389);
if($t->open("computer.name.or.ip")) {
    print "Connect successful\n";
}
else {
    print "Could not connect\n";
}

The idea was to attempt a connection and if it can't connect within 'x' amount of seconds, assume it isn't going to work. Gets a bit more complicated if you're trying to see if a login for a specific user works or not, but this should at least get you started.

NOTE: As pointed out in the comments, the original solution left out the RDP port, so I included that in this...

Kevin Fairchild
RDP runs on port 3389... so you'll need to add that to your example.
ceretullis
Thanks, austirg. Totally missed that.
Kevin Fairchild
Just to clarify, I'm looking for more than just telnet. I need the confirm that not only can the connection be handled, but that Remote Desktop is also responsive.
Rob