Test open network ports using Powershell
Most frequently when deploying new scenarios, the task of network connectivity validation has to be performed.Commonly this is performed using a command line and issuing a “telnet” connection to the desired host on a given port. This is nice when you have a single machine with a couple of connections to be tested.
When the scenario involves tens of machines with different network connection requisites between each other, the telnet procedure is a very slow process, being the typical test cycle:
- Open command prompt.
- Issue telnet to a given host and port.
- On success, close window and return to step 1.
- On failure, wait for timeout.
- Authorize the network port that failed
- Repeat step 2.
- On success go to step 1.
- Open command prompt.
- Issue command or script to test all destination hosts on desired ports.
- Check status and authorize failed network traffic.
- Repeat step 2 and check for success.
To surpass these annoyances, one can use this Powershell function “Test-Port”, available from the Microsoft Technet Script Center Repository.
The syntax of the base usage is really simple. To test conecctivity to this site:
Test-port -computer blog.ozzie.eu -port 80
To address the fact of the ever growing shared network resources to be tested, an Excel spreadsheet can be used to generate the test battery script. Here’s an example you can view and download:
Afterwards, you just copy/paste the powershell column to a .ps1 file. I’ve also included a regular command prompt test column.
HTH.
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment