Powershell – Pare feu Windows

Pour pouvoir vérifier l’état de notre pare-feu Windows, il suffit de taper la commande:

[pastacode lang= »c » manual= »netsh%20advfirewall%20set » message= » » highlight= » » provider= »manual »/]

Pour activer ou désactiver votre pare feu :

Désactivation :

[pastacode lang= »c » manual= »Set-NetFirewallProfile%20-Profile%20Domain%2CPublic%2CPrivate%20-Enabled%20False%0A%0AOU%0A%0ASet-NetFirewallProfile%20-Profile%20*%20-Enabled%20False » message= » » highlight= » » provider= »manual »/]

Dans la première commande vous pouvez choisir de désactiver certains les types de Profiles « Domain » Public » ou/et « Private »

Activation :

[pastacode lang= »c » manual= »Set-NetFirewallProfile%20-Profile%20Domain%2CPublic%2CPrivate%20-Enabled%20True%0A%0AOU%0A%0ASet-NetFirewallProfile%20-Profile%20*%20-Enabled%20True%0A » message= » » highlight= » » provider= »manual »/]

Dans la première commande vous pouvez choisir de d’activer certains les types de Profiles « Domain » Public » ou/et « Private »

 

Pour autoriser certaine port :

Commencer par importer le module NetSecurity :

[pastacode lang= »c » manual= »Import-Module%20NetSecurity » message= » » highlight= » » provider= »manual »/]

Puis pour :

[pastacode lang= »c » manual= »New-NetFirewallRule%20-Name%20%22DNS%22%20-DisplayName%20%22Autoriser%20service%20DNS%22%20-Profile%20Domain%20-Enabled%20True%20-Protocol%20TCP%20-LocalPort%2053%20-Action%20Allow » message= »DNS » highlight= » » provider= »manual »/]

[pastacode lang= »c » manual= »New-NetFirewallRule%20-Name%20Allow_Ping%20-DisplayName%20%E2%80%9CAllow%20Ping%E2%80%9D%20%20-Description%20%E2%80%9CPacket%20Internet%20Groper%20ICMPv4%E2%80%9D%20-Protocol%20ICMPv4%20-IcmpType%208%20-Enabled%20True%20-Profile%20Any%20-Action%20Allow » message= »ICMP » highlight= » » provider= »manual »/]

ETC …

Laisser un commentaire