How to display firewall rule ports numbers with PowerShell
Displaying firewall rules with PowerShell is very easy with the Get-NetFirewallRule cmdlet.
However, there is a gap: port numbers are not displayed.
Displaying firewall rules with PowerShell is very easy with the Get-NetFirewallRule cmdlet.
However, there is a gap: port numbers are not displayed.
You may be probably a little lost when you start working with Powershell cmdlets handling secure strings.
Indeed, one can think that ConvertFrom-SecureString gives you back what you entered with Read-Host -AsSecureString or ConvertTo-SecureString.
But that’s not the case!
Officially, with version 10.03 this method is not supported.
However, I was able to figure out the prerequisites to make it work.
Please note that this post is not intended to absolute PowerShell beginners, but rather to Windows PowerShell users who want to give a try to PowerShell Core aka PowerShell 6.x.
On this one, I will not go very deep with the explanation because it implies many PowerShell knowledge.
However, I will explain the main principle and give a sample of code to make your work easier if you understand it.
Most of the time, you will just have to adapt it to match your needs.
You must be logged in to post a comment.