# Poke! that port…

We are always using telnet to test TCP port availability, and it is almost always available. In the event that it is not, or you want something a little more robust, I have been playing around with a script that I found on serverfault here:
http://serverfault.com/questions/560081/check-port-open-without-telnet

poke.ps1 is a cmdlet written in powershell to tell you whether or not a TCP port is open on a particular host.

poke.ps1

Syntax:
./poke.ps1 HOST_IP PORT
If you want to test a range of ports just add an additional end to the port range as follows:
./poke.ps1 HOST_IP STARTPORT ENDPORT
It currently does only TCP, but could easily be adapted for UDP with a couple keystrokes.

If you want to add an alias so that you don’t have to type the ./ or .ps1 everytime, use the following instructions:

• First you need to setup your powershell profile, if you haven’t done so already.
• Create a directory where you want to keep your aliased scripts (I use c:\ps)
$ps_script_dir = "c:\path\to\scripts" New-Alias <alias name>$ps_script_dir\<script name>
• Open a new shell and you should be able to call your script by its alias

function someUsefulOneliner