Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: terminal server remote
For starters, you could attempt to establish a TCP connection to the TCP port typically used for accepting RDP [Remote Desktop Protocol] connections. If Citrix is involved then you could also perform the same test using the TCP port commonly used for ICA protocol connections. Failing to connect to the port indicates that no terminal services of any sort are active [or they are listening on TCP ports other than the ones that you are testing for]. Successfully making the TCP connection indicates that a service [presumably the terminal services service] are active on that TCP port. You would use the WinSock extender to do this testing.
Another option is to examine the actual services running on the remote system. If you find a service related to terminal services present and running then you know that terminal services are active on the system. Use the wntSvcStatus() function to test for whether or not a service exists on any particular system. You use the Win32 Network [NT] extender to do this. The service's display name on WinNT v4.0 Terminal Server Edition is "Terminal Server". On Win2K it is "Terminal Services". I don't have WinXP system booted up right at the moment to see if the service's display name changed again in that version of Windows. There are additional services that Citrix Winframe and Metaframe install on top of their base Windows operating systems. If Citrix is in your environment then you would also need to check for those services as well.
If you actually dig around in the registry of the remote system you can determine whether the terminal server service has been configured to use terminal server licensing. If it has been configured to use licensing then it is set up in application terminal services mode and is definitely running as a terminal server. If it has not been configured to use licensing then it is running in remote administration terminal services mode and is not really a true application terminal server system.
I think that a combination of detecting services & interrogating the registry, or just doing it all through the registry, is the best way to go with this. It will be the most reliable method that you can use.
:start pslist.exe \\remote-node | find.exe /i "termsrv" if errorlevel 1 goto not_found ;;; s:\util32\sleep 10 goto start :not_foundfind is part of the OS, pslist is free from www.sysinternals.com
list = wntServerList("\\PDC","DOMAIN",33554432) AskItemList("list of Terminal Servers",list,@tab,@sorted,@single) exit
Article ID: W15217
File Created: 2004:01:20:14:45:22
Last Updated: 2004:01:20:14:45:22