Q:

How to automate testing connectivity to Windows 2003 server?

I am writing an app to test RDP connectivity to a bank of VM Windows 2003 servers.  The typical failure mode is for some code running on the server to get itself in a loop, preventing RDP connections -- and most any other type of connection, as well.  When this happens, you can still ping the server and it seems to be fine, but you cannot do much of anything else.
I am using C#, .NET 3.5 and RDP version 6.1 -- I have tried launching the ActiveX RDP client (MSTSC..) but that requires human intervention and doesn't work very well.  I found another post here that has a possible solution from Expert Sexchange, but that solution uses Java and the Net::Telnet library, which I do not have access to.
Any ideas from the .NET camp?
Thanks,
Dave

A:

You can use the undocumented WinStationServerPing API to check connectivity to Terminal Server. Basically if this function succeeds it means that Terminal Server is available.
This is the (Delphi) signature of the function (exported from winsta.dll):
function WinStationServerPing(hServer: HANDLE): BOOLEAN; stdcall;

