I would suggest you to look into some cmdlets that will let you interact with the Firewall. Like Get-NetFirewallRule and Get-NetFirewallPortFilter. Try to see what you can get back with it, and try to use it to do your check.
btw: if you would have used Get-Command get*firewall*, you would have found a lot of firewall related cmdlets.
The topic ‘Check For Open Port with If then statement’ is closed to new replies.