I noticed that the PowerShell New-NetFirewallRule
cmdlet does not behave like I expected. When calling the commandlet repeatedly, it will create multiple entries with the same name.
For example, when running this command twice New-NetFirewallRule -DisplayName "Website" -Direction Inbound -LocalPort 80 -Protocol TCP -Action Allow
, will give two of the same firewall entries.
Should commands with the New
verb not fail when the resource already exists?
When New-NetFirewallRule
retuns an object with the firewall rule, Set-NetFirewallRule
returns nothing.
Running Set-NetFirewallRule
does not work for creating a new rule. It will raise an error which says that the resource does not exist. I expected a Set
verb updates or creates the resource.
Using PowerShell 5.1 on Windows Server 2016