Problem:
How can I test a range of ports for network connectivity in PowerShell?
Solution:
foreach ($port in 1..1024) {If (($a=Test-NetConnection srvfs01 -Port $port -WarningAction SilentlyContinue).tcpTestSucceeded -eq $true){ "TCP port $port is open!"}}
Great solution!
Thanks!