PowerShell で Windows Firewall に規則を追加する

管理者権限で New-NetFirewallRule コマンドレットを実行。サンプルは次の通り。

New-NetFirewallRule -Name Example -DisplayName "Example TCP" -Description "Example Permit TCP/443" -Protocol TCP -LocalPort 443 -Enabled True -Profile Any -Action Allow

Docker や Packer で結構使うのでメモ。