piszczynski>Aleks (Created page with " == Windows Firewall Rules == Create windows firewall rule in PS: *New-NetFirewallRule -DisplayName "rule name" -Direction Inbound -LocalPort 80,443<ports seperated by commas...") |
No edit summary |
||
| (5 intermediate revisions by the same user not shown) | |||
| Line 2: | Line 2: | ||
== Windows Firewall Rules == | == Windows Firewall Rules == | ||
Create windows firewall rule in PS: | Create windows firewall rule in PS:<syntaxhighlight lang="powershell"> | ||
New-NetFirewallRule -DisplayName "rule name" -Direction Inbound -LocalPort 80,443<ports seperated by commas> -Protocol TCP -Action Allow | |||
</syntaxhighlight>Check the enabled profile and the default settings:<syntaxhighlight lang="powershell"> | |||
Get-NetFirewallProfile | Select-Object Name, Enabled, DefaultInboundAction, DefaultOutboundAction | Format-Table -AutoSize | |||
</syntaxhighlight> | |||
* | |||
Find firewall rules by port number: | Find firewall rules by port number:<syntaxhighlight lang="powershell"> | ||
Get-NetFirewallPortFilter | Where-Object { $_.LocalPort -eq <port_number> } | Get-NetFirewallRule | |||
</syntaxhighlight> | |||
== Enable File and Printer sharing == | |||
Enable file and printer sharing in windows firewall | |||
<syntaxhighlight lang="powershell">Set-NetFirewallRule -DisplayGroup "File And Printer Sharing" -Enabled True -Profile Domain | |||
</syntaxhighlight> | |||
== Enable ICMP ( ping ) == | |||
<syntaxhighlight lang="powershell"> | |||
#IPv4 | |||
netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol="icmpv4:8,any" dir=in action=allow | |||
#IPv6 | |||
netsh advfirewall firewall add rule name="ICMP Allow incoming V6 echo request" protocol="icmpv6:8,any" dir=in action=allow | |||
</syntaxhighlight> | |||
Latest revision as of 15:58, 24 November 2025
Windows Firewall Rules
Create windows firewall rule in PS:
New-NetFirewallRule -DisplayName "rule name" -Direction Inbound -LocalPort 80,443<ports seperated by commas> -Protocol TCP -Action Allow
Check the enabled profile and the default settings:
Get-NetFirewallProfile | Select-Object Name, Enabled, DefaultInboundAction, DefaultOutboundAction | Format-Table -AutoSize
Find firewall rules by port number:
Get-NetFirewallPortFilter | Where-Object { $_.LocalPort -eq <port_number> } | Get-NetFirewallRule
Enable File and Printer sharing
Enable file and printer sharing in windows firewall
Set-NetFirewallRule -DisplayGroup "File And Printer Sharing" -Enabled True -Profile Domain
Enable ICMP ( ping )
#IPv4
netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol="icmpv4:8,any" dir=in action=allow
#IPv6
netsh advfirewall firewall add rule name="ICMP Allow incoming V6 echo request" protocol="icmpv6:8,any" dir=in action=allow