firewall

New-NetFirewallRule
Remove-NetFirewallRule

Disable-NetFirewallRule
Enable-NetFirewallRule

Get-NetFirewallRule
Show-NetFirewallRule

Rename-NetFirewallRule
Copy-NetFirewallRule
Set-NetFirewallRule

block exe

New-NetFirewallRule -Program “C:\Program Files (x86)\Mozilla Firefox\firefox.exe” -Action Block -Profile Domain, Private -DisplayName “Block Firefox browser” -Description “Block Firefox browser” -Direction Outbound

Disable-NetFirewallRule -DisplayName 'WEB-Inbound'
Remove-NetFirewallRule -DisplayName "Block WINS"

show blocked exe File

Get-NetFirewallRule -Action Block -Enabled True -Direction Outbound | %{$_.Name; $_ | Get-NetFirewallApplicationFilter}

active inbound

Get-NetFirewallRule | where {($_.enabled -eq $True) -and ($_.Direction -eq "Inbound")} |ft

active outbound blocking

Get-NetFirewallRule -Action Block -Enabled True -Direction Outbound

table

Get-NetFirewallRule -Action Allow -Enabled True -Direction Inbound |
Format-Table -Property Name,
@{Name='Protocol';Expression={($PSItem | Get-NetFirewallPortFilter).Protocol}},
@{Name='LocalPort';Expression={($PSItem | Get-NetFirewallPortFilter).LocalPort}},
@{Name='RemotePort';Expression={($PSItem | Get-NetFirewallPortFilter).RemotePort}},
@{Name='RemoteAddress';Expression={($PSItem | Get-NetFirewallAddressFilter).RemoteAddress}},
Enabled,Profile,Direction,Action

profile

enable disable

Set-NetFirewallProfile -All -Enabled True
Set-NetFirewallProfile -All -Enabled False

Set-NetFirewallProfile -Profile Public -Enabled True

Set-NetFirewallProfile -Name Public -DefaultInboundAction Block
Get-NetFirewallProfile -Name Public

https://woshub.com/manage-windows-firewall-powershell/

posted @ 2023-05-19 14:10  fndefbwefsowpvqfx  阅读(15)  评论(0编辑  收藏  举报