PowerShell is King–Test RDP Connection and Connect
Posted by Mikael Nystrom on July 2, 2014
So, during the class today we talked about simple but useful things you could do with PowerShell. So we had a very simple situation, during reboot of servers everyone asked “how long time does it take to reboot the server?” Since this is real servers, with a real firmware the correct answer will “Longer then you would like it to take…”. So, ping the machine, wait to you get the response is what IT pros does, or could a very simple PowerShell function be a better way?
Using this method it will use the Test-NetConnection until it succeeds accessing TCP 3389 and then fire up MSTC.exe and connect, simple and neat.
Download it from: http://1drv.ms/1o7PgK7
Run it (or load it as a module)
Execute the following command from the PowerShell prompt like this: