The Deployment Bunny

OS Deployment, Virtualization, Microsoft based Infrastructure…

  • Archives

  • Meta

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?

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

3 Responses to “PowerShell is King–Test RDP Connection and Connect”

  1. Thanks for the Powershell version of this. Myself used Autoit v3 to do the same thing.

  2. MIke said

    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.

    • Mike said

      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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

Join 3,866 other followers

%d bloggers like this: