注释简单,你懂的,因为懒,想学的话逐条执行一次就知道个大概!
// 打开防火墙界面 wf.msc
// 不含空格字符串的双引号可省略,例:-DisplayName "Newrule" 可以写成 -DisplayName Newrule
// 添加规则,参数 -Name 可省略
New-NetFirewallRule -DisplayName "Newrule" -Direction Inbound -Action Allow -LocalPort 21,1021-1022 -Protocol TCP
New-NetFirewallRule -DisplayName "Allow TCP 12345 and 5000-5020 over Teredo" -Direction Inbound -Action Allow -EdgeTraversalPolicy Allow -Protocol TCP -LocalPort 12345,5000-5020 -Program "C:\Program Files (x86)\TestIPv6App.exe"
New-NetFirewallRule -DisplayName "Allow Messenger" -Direction Inbound -Program "C:\Program Files (x86)\Messenger\msmsgs.exe" -RemoteAddress LocalSubnet -Action Allow
New-NetFirewallRule -DisplayName "Newrule" -Direction Inbound -Action Allow -LocalPort 1021 -Protocol TCP -RemoteAddress "192.168.1.0/24"
New-NetFirewallRule -Name "Newrule" -DisplayName