PortQryV2.exe

PortQryV2.exe is a standalone binary from Microsoft. It appears that the last release was around the Server2003/XP days but it can still be downloaded and is still useful. Once downloaded, the installer file creates a directory and drops the PortQry.exe file in it. This is nice to have when a server is behind firewalls and troubleshooting is required.

A simple example that checks if port 445 is available using both TCP and UDP (445 is TCP – this is just an example to show use):

portqry.exe  -n myserver.mydomain.com -e 445 -p 

As always, get help:

portqry.exe /?

Windows Server DNS Scavenging Failure

On Windows Servers with the DNS role installed, automatic scavenging can be configured to clean up stale endpoint entries that are registered in a zone. Scavenging can fail though, even when the server and zone have been setup properly. See the popular link at the end of this post (reference 1) to see the three places that must be configured within DNS for scavenging to work.

What is important to understand here in this post though is: 1) scavenging takes time, and 2) the problem I am discussing must be fixed using the command-line utility “dnscmd”.

Open “cmd.exe” as admin on the server configured to run scavenging and run the following command:

dnscmd /zoneinfo <dnszone.com>

Look for the IP address – it should be near the bottom of the output. This address should be the address of the server that you have configured to run the scavenging process. In my case, the address displayed was that of the old server that no longer exists in the domain. So we need to change it to the proper scavenging server’s IP address. The second reference below provides this example to change the IP address:

dnscmd /zoneresetscavengeservers <dnszone.com> <Ip of the current DNS Server>

References:

  1. https://sysadminray.wordpress.com/2012/09/29/dont-be-afraid-of-dns-scavenging-just-be-patient/
  2. https://support.microsoft.com/en-us/help/2791165/dns-scavening-records-are-not-deleted-if-scavenging-manually-disabled

Get Windows Server Uptime (also Windows 10)

I have needed to retrieve the uptime from several Windows servers in the last few months. There is a number of ways to do this but I can’t seem to remember how to do this when I need to. Obviously a native “uptime” command would be too easy. So here is one way (use these commands in the cmd.exe terminal):

net statistics server

Look for the “Statistics since” line.

Or use this command:

systeminfo | find "Time"

On windows 10:

net statistics workstation

Note that these commands don’t return the actual uptime, but rather the last boot time. If you really want the math done for you so that you get the actual uptime in a human format, and you have a GUI front end, then do the following:

Start the Task manager.
Click the "Performance" tab.