命令行关闭防火墙
关闭防火墙:
netsh firewall set opmode mode=disable
关闭防火墙:
netsh advfirewall set allprofiles state off
查看防火墙状态:
netsh advfirewall show allprofiles
命令行powershell新建出入站规则
入站–修改为Inbound (不允许重名)
New-NetFirewallRule -Name "1433In" -DisplayName "1433In" -Description "Allow inbound HTTP traffic" -Direction Inbound -LocalPort 1433 -Protocol TCP -Action Allow -Enabled True
出站–修改为Outbound
New-NetFirewallRule -Name "1433Out" -DisplayName "1433Out" -Description "Allow inbound HTTP traffic" -Direction Outbound -LocalPort 1433 -Protocol TCP -Action Allow -Enabled True
查看现有规则
(所有入站规则)
Get-NetFirewallRule -Direction Inbound
(所有出站规则)
Get-NetFirewallRule -Direction Outbound
删除规则
指定规则的名称或其他唯一标识符
Remove-NetFirewallRule -Name "1433Out"