大网数据广告活动
磁盘与文件系统

SMB - File and printer sharing ports should be open

· 52CE 我爱测

Learn how to keep file and printer sharing ports open for Server Message Block (SMB)-based network services and resolve the Best Practices Analyzer scan issue.

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:

  1. Open Control Panel, select System and Security, and then select Windows Defender Firewall.

  2. On the left, select Advanced settings. The Windows Defender Firewall console opens and shows the advanced settings.

  3. In the Windows Defender Firewall console on the left, select Inbound Rules.

  4. Under Inbound Rules, locate the following two rules:

    • File and Printer Sharing (NB-Session-In)

    • File and Printer Sharing (SMB-In)

  5. 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.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Server documentation
适用范围
Windows Server · Source date 03/20/2023
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。