Open in the explorer

Windows Defender Firewall: Allow inbound file and printer sharing exception

Pare-feu Windows Defender : autoriser l'exception de partage de fichiers entrants et d'imprimantes

Type
Computer
GPO path
Computer Configuration › Policies › Administrative Templates › Network › Network Connections › Windows Defender Firewall › Domain Profile FR: Configuration ordinateur › Stratégies › Modèles d'administration › Réseau › Connexions réseau › Pare-feu Windows Defender › Profil du domaine
Supported on
At least Windows XP Professional with SP2 FR: Au minimum Windows XP Professionnel avec SP2
ADMX file
WindowsFirewall.admx
Internal name
WindowsFirewall/WF_FileAndPrint_Name_1

Explanation

Allows inbound file and printer sharing. To do this, Windows Defender Firewall opens UDP ports 137 and 138, and TCP ports 139 and 445.

If you enable this policy setting, Windows Defender Firewall opens these ports so that this computer can receive print jobs and requests for access to shared files. You must specify the IP addresses or subnets from which these incoming messages are allowed. In the Windows Defender Firewall component of Control Panel, the "File and Printer Sharing" check box is selected and administrators cannot clear it.

If you disable this policy setting, Windows Defender Firewall blocks these ports, which prevents this computer from sharing files and printers. If an administrator attempts to open any of these ports by adding them to a local port exceptions list, Windows Defender Firewall does not open the port. In the Windows Defender Firewall component of Control Panel, the "File and Printer Sharing" check box is cleared and administrators cannot select it.

If you do not configure this policy setting, Windows Defender Firewall does not open these ports. Therefore, the computer cannot share files or printers unless an administrator uses other policy settings to open the required ports. In the Windows Defender Firewall component of Control Panel, the "File and Printer Sharing" check box is cleared. Administrators can change this check box.

Note: If any policy setting opens TCP port 445, Windows Defender Firewall allows inbound ICMP echo requests (the message sent by the Ping utility), even if the "Windows Defender Firewall: Allow ICMP exceptions" policy setting would block them. Policy settings that can open TCP port 445 include "Windows Defender Firewall: Allow inbound file and printer sharing exception," "Windows Defender Firewall: Allow inbound remote administration exception," and "Windows Defender Firewall: Define inbound port exceptions."

French text from Windows 11 26H2

Autorise le partage de fichiers entrants et des imprimantes. Dans ce but, le Pare-feu Windows Defender ouvre les ports UDP 137 et 138 et les ports TCP 139 et 445.

Si vous activez ce paramètre de stratégie, le Pare-feu Windows Defender ouvrira ces ports pour autoriser l'ordinateur à recevoir des travaux d'impression et des demandes d'accès aux fichiers partagés. Vous devez spécifier les adresses IP ou les sous-réseaux depuis lesquels les messages entrants sont autorisés. Dans le composant Pare-feu Windows Defender du Panneau de configuration, la case à cocher « Partage de fichiers et d'imprimantes » sera activée et les administrateurs ne pourront pas la désactiver.

Si vous désactivez ce paramètre de stratégie, le Pare-feu Windows Defender bloquera ces ports pour empêcher l'ordinateur local de partager des fichiers et des imprimantes. Si un administrateur tente d'ouvrir l'un de ces ports en l'ajoutant à une liste d'exceptions de ports locaux, le Pare-feu Windows Defender n'ouvre pas le port. Dans le composant Pare-feu Windows Defender du Panneau de configuration, la case à cocher « Partage de fichiers et d'imprimantes » sera désactivée et les administrateurs ne pourront pas l'activer.

Si vous ne configurez pas ce paramètre de stratégie, le Pare-feu Windows Defender n'ouvrira pas ces ports. L'ordinateur ne peut donc pas partager de fichiers ou d'imprimantes, sauf si un administrateur utilise d'autres paramètres de stratégie pour ouvrir les ports requis. Dans le composant Pare-feu Windows Defender du Panneau de configuration, l'option « Partage de fichiers et d'imprimantes » est désélectionnée. Les administrateurs peuvent modifier cette case à cocher.

Remarque : si un paramètre de stratégie ouvre le port TCP 445, le Pare-feu Windows Defender autorise les requêtes d'écho ICMP entrants (les messages envoyés par l'utilitaire Ping), même si le paramètre de stratégie « Pare-feu Windows Defender : autoriser les exceptions ICMP » les bloque. Les paramètres de stratégie qui peuvent ouvrir le port TCP 445 incluent notamment « Pare-feu Windows Defender : autoriser l'exception de partage de fichiers entrants et d'imprimantes », « Pare-feu Windows Defender : autoriser l'exception d'administration à distance entrante » et « Pare-feu Windows Defender : définir les exceptions de ports entrants ».

Registry

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsFirewall\DomainProfile\Services\FileAndPrint
Value name
Enabled
StateValue written
EnabledREG_DWORD = 1
DisabledREG_DWORD = 0

PowerShell

PowerShell commands that write to the registry what the policy would write. Values in angle brackets (<…>) must be replaced.

Writing directly to the registry bypasses Group Policy: if a GPO manages this value, it will be rewritten at the next gpupdate; otherwise the value stays in place (the "tattooing" effect). Prefer a GPO or, locally, LGPO.exe. Run PowerShell as administrator for HKLM. Some policies need a restart or gpupdate /force.

Enable

# Enable: WindowsFirewall/WF_FileAndPrint_Name_1
$k = 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\DomainProfile\Services\FileAndPrint'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'Enabled' -Value 1 -Type DWord
# Allow unsolicited incoming messages from these IP addresses
Set-ItemProperty -Path $k -Name 'RemoteAddresses' -Value '<value>' -Type String

Disable

# Disable: WindowsFirewall/WF_FileAndPrint_Name_1
$k = 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\DomainProfile\Services\FileAndPrint'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'Enabled' -Value 0 -Type DWord

Revert to "Not configured"

# Revert to "Not configured": WindowsFirewall/WF_FileAndPrint_Name_1
$k = 'HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\DomainProfile\Services\FileAndPrint'
Remove-ItemProperty -Path $k -Name 'Enabled' -ErrorAction SilentlyContinue
Remove-ItemProperty -Path $k -Name 'RemoteAddresses' -ErrorAction SilentlyContinue

Options (1)

LabelControlRegistry valueREG typeConstraints / details
Allow unsolicited incoming messages from these IP addresses:Autoriser les messages entrants non sollicités provenant des adresses IP suivantes :WF_Scope_NameText boxtextRemoteAddressesREG_SZ

Availability