Ping & RDP status

by Aug 23, 2013


I have a little script that indentify the ping status of servers:

get-content c:servers.txt | foreach { if (test-connection $_ -quiet) { write-output "$_ is Pingable" | out-file c:results.txt -append } else {write-output "$_ is down" | out-file c:results.txt -append}}

No problem with this | but somehow would like to check RDP status (put RDP results the same output file) that I can log on to, of course, only to pingable servers. I am checking the RDP status manually, is it possible? any idea would be appreciated.. I know I am too lazy, but  PS script can solve this. 🙂