PowerShell

PowerShell is King–Test RDP Connection and Connect

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?

image

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:

image

/mike

Categories: PowerShell

Tagged as:

3 replies »

  1. Just as a heads up, the “Test-NetConnection” commandlet requires PowerShell v4. Since at work we’re stuck at v2 for the time being I’ll have to wait on using this until we upgrade. In the meantime your function is sitting in my profile just waiting for its day to come.

    • It also looks like it requires Windows 8.1 to work as well. After installing PowerShell 4 on my Windows 7 machine the “Test-NetConnection” cmdlet is not available.

      Looks like it is one of the command built into Windows 8.1 and not PowerShell 4.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.