Applies To: Windows Server 2022, Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows Server 2012, Windows Server 2008 R2
When a Best Practices Analyzer scan for Server Message Block (SMB)-based network services identifies that firewall ports for file and printer sharing aren't open, follow the steps in this article to resolve the issue.
| Operating system | Product/Feature | Severity | Category |
|---|---|---|---|
| Windows Server | File Services | Error | Configuration |
Note: This article addresses a specific issue identified by a Best Practices Analyzer scan. Apply the information in this article only to computers that have a File Services Best Practices Analyzer scan that reports the specific port issue. For more information about best practices and scans, see Best Practices Analyzer.
Identify the issue
A File Services Best Practices Analyzer scan reports that firewall ports necessary for file and printer sharing aren't open (ports 445 and 139).
The issue prevents computer access to shared folders and other SMB-based network services on the server.
Resolve the issue
To resolve the issue, enable file and printer sharing to communicate through the computer's firewall. To complete the procedure, you must be a member of the Administrators group (or equivalent), at a minimum.
To open the firewall ports and enable file and printer sharing, complete the following steps:
-
Open Control Panel, select System and Security, and then select Windows Defender Firewall.
-
On the left, select Advanced settings. The Windows Defender Firewall console opens and shows the advanced settings.
-
In the Windows Defender Firewall console on the left, select Inbound Rules.
-
Under Inbound Rules, locate the following two rules:
-
File and Printer Sharing (NB-Session-In)
-
File and Printer Sharing (SMB-In)
-
-
For each rule, select and hold (or right-click) the rule, and then select Enable Rule.
Note: The preceding steps configure Windows Defender Firewall on a single server. If you manage applicable devices with Microsoft Intune, you can centrally deploy Windows Defender Firewall policy and firewall rules to multiple devices instead of configuring each server locally. Intune doesn't run the Best Practices Analyzer or convert its findings automatically. Instead, you define the equivalent inbound firewall rules for file and printer sharing in an endpoint security firewall policy. For the procedure, see Firewall policy for endpoint security in Intune.
Related links
Source: Microsoft Learn / Windows Server documentation by Microsoft and contributors (upstream author metadata: robinharwood). Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.
