Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Determine if a specified server is listening on the default RDP port
# relies on portqry (see
param (
$rdpPort = 3389
PortQry.exe -n $server -e $rdpPort

This comment has been minimized.

Copy link
Owner Author

drmohundro commented Aug 20, 2015

So you've restarted a remote server. Obviously, it kicks you off of RDP. You want to RDP into it once it has rebooted, though. So you keep RDPing but you don't know when it is back yet.

I used to just run ping -t MyServer and wait for it to start responding, but the problem is that the ping response can start before the RDP service begins listening.

Using this, I can know if the RDP service has started listening or not.

It requires the PortQry tool to be in your PATH first.

(side note - I can never remember the name of PortQry either...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.