Windowsfirewall: Difference between revisions

From Piszczynski
No edit summary
 
Line 14: Line 14:


Enable file and printer sharing in windows firewall
Enable file and printer sharing in windows firewall
<syntaxhighlight lang="powershell">Set-NetFirewallRule -DisplayGroup "File And Printer Sharing" -Enabled True -Profile Private
<syntaxhighlight lang="powershell">Set-NetFirewallRule -DisplayGroup "File And Printer Sharing" -Enabled True -Profile Domain
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 13:57, 5 December 2023

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

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