Finding that I often do quick port tests related to ConfigMgr installations @ customer sites, and my traditional approach was to use TELNET and NETSTAT together, checking for ports marked as SYN (no synchronisation packet came back) as an indicator that the port is blocked or not being listened on, so I thought, why don’t I write a new (extensible) Tcp port checker to do the job for me.
Falling back to the classic Tcp port test, use TELNET to test a Tcp port, and NETSTAT to see what is happening:
TELNET IP PORT
NETSTAT –AN | FIND /I “SYN”
You have to do this fast, within a second or two, or you’ll miss the port SYN state and get no results back. Try it, has helped me out a lot over the years.
Well, half-way through coding this new tool, as I often just code for fun and, can get carried away between a mere thought and my hands whizzing back and forth in Visual Studio creating something, I checked to see if anyone else had a cool port checker, and found this (lol oops how can I forget that old Microsoft port checking puppy!), this, and another that I cannot locate the link for again, was ConfigMgr specific and was fed by a XLS, I’ll update the post another time if I remember, and include a call out to that tool as it was the first one I found.
So yeah, I wanted to call these tools out that came ahead of mine, go ahead, check them out, a port checker is a port checker after all, so choose your poison and get the result you want (Port open, Port closed).
My tool is Tcp only I’m afraid. Udp is a tricky beast to validate. If I can get something reasonable that is reliable (so many conditions can make testing Udp pointless), I’ll update the tool with it. Framework code for Udp is there, so implementing Udp is a cinch if I sort out the Udp Port checking logic.
This version doesn’t handle DNS lookup of the hostname very well, works for some of you, IP always works, I’ll fix this at the next release. And also IPV6 isn’t supported until the next release.
CheckPort for ConfigMgr is Wrapped as an MSI to make installing\uninstalling a breeze (thanks Flexera Software for InstallShield Express!).
Unblock the MSI if Windows warns you it is from an untrusted source. I am in two minds if I should buy a certificate to sign my tools so that they are trusted by Microsoft, but that costs £££, maybe one day.
I mentioned above that this thing is extensible, well it sure is, it can either run as a stand-alone EXE with all ConfigMgr rules built-in, or feed off of a four-column CSV file (Test name, Port Name, Port, Tcp\Udp) located in the same directory as the EXE. The MSI installer will drop a sample CSV file into the installation folder for you to check out.
Download the tool from the TechNet Gallery
And … enjoy!