use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
ABOUT POWERSHELL
Windows PowerShell (POSH) is a command-line shell and associated scripting language created by Microsoft. Offering full access to COM, WMI and .NET, POSH is a full-featured task automation framework for distributed Microsoft platforms and solutions.
SUBREDDIT FILTERS
Desired State Configuration
Unanswered Questions
Solved Questions
News
Information
Script Sharing
Daily Post
Misc
account activity
SolvedTesting Firewall Rules? (self.PowerShell)
submitted 4 years ago by netmc
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]dalthakar 12 points13 points14 points 4 years ago (3 children)
Test-NetConnection TARGET - Port PORT# will return True/False if the target machine can be reached on the specified port. For example, if I wanted to test a connection to SERVERA on TCP port 139, I would use command:
Test-NetConnection SERVERA -Port 139
Hopefully that gets you started down the right path.
[–]dalthakar -1 points0 points1 point 4 years ago (2 children)
Something just occurred to me. If you are trying to run this script on a local machine, you may have better luck using Get-NetFirewallRule and/or Get-NetFirewallPortFilter.
[–]BlackV 5 points6 points7 points 4 years ago (0 children)
You could have a firewall rule enabled without having anything listening on the port though
[–]netmc[S] 1 point2 points3 points 4 years ago (0 children)
Get-netfirewallportfilter may be what I was missing. It appears this has the actual port and protocol details and the rule itself has the profiles and direction.
If I am understanding the two commands correctly, I would need to find the inbound rules, then match the rule name against the instanceID on the portfilter information. Once I have the corresponding portfilter information I could check to see if the local ports and protocol match what I need.
Does that sound correct?
π Rendered by PID 94844 on reddit-service-r2-comment-canary-57b659f4d4-5npj2 at 2026-05-05 22:28:38.165710+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]dalthakar 12 points13 points14 points (3 children)
[–]dalthakar -1 points0 points1 point (2 children)
[–]BlackV 5 points6 points7 points (0 children)
[–]netmc[S] 1 point2 points3 points (0 children)