Windows 10 Firewall Rule追加

Windows 10 Firewall Rule追加

 

[コマンドプロンプトの場合]

管理者権限としてcmd.exeを起動

C:\>REM BLOCK ALL inbound TCP protocol

C:\>netsh advfirewall firewall add rule name="IN_BLOCK_ALL" dir=in action=block protocol=TCP remoteport=1-65535

 

[PowerShellの場合]

PS C:\>New-NetFirewallRule -DisplayName 'Open Port 50080' -Description 'Open Port 50080' -Enabled False -Profile Any -Direction Inbound -Action Block -Program Any -LocalAddress Any -RemoteAddress Any -Protocol TCP -LocalPort 53389 -RemotePort Any -LocalUser Any -RemoteUser Any
PS C:\>Set-NetFirewallRule '{guid}' -Enabled True