Powershell: Open TCP listener port

If you want to test a firewall rule, while the application isn’t ready yet, you can start that port on the Windows server using Powershell.
This way you can test the firewall functionality.
Those actions can be done with the following commands:

$Listener = [System.Net.Sockets.TcpListener]4444; $Listener.Start(); 

Where “4444” is the TCP port that you want to open.
Once ready, you need to stop the listener again. You can use the following command for this:

$Listener.Stop(); 

 

Enjoy!

Default image
Bart
Articles: 80