Created
August 20, 2015 16:42
-
-
Save drmohundro/9eba676128f37fbcac32 to your computer and use it in GitHub Desktop.
Determine if a specified server is listening on the default RDP port
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# relies on portqry (see http://www.microsoft.com/en-us/download/details.aspx?id=24009) | |
param ( | |
[Parameter(Mandatory=$true)] | |
[string] | |
$server, | |
[int] | |
$rdpPort = 3389 | |
) | |
PortQry.exe -n $server -e $rdpPort |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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...