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

Configure alternative SMB ports for Windows Server 2025

· 52CE 我爱测

How to configure alternative SMB ports on Windows Server 2025

You can use the SMB client to connect to alternative TCP, QUIC, and RDMA ports. However, you can only connect to alternative ports if the SMB server is configured to support listening on that port.

You can also configure your deployment to block configuring alternative ports or specify that ports can only connect to certain servers.

Prerequisites

In order to configure alternative ports, you need the following:

  • Your system must be running one of the following two operating systems:

    • Windows 11, version 24H2 or later

    • Windows Server 2025 or later

  • Admin permissions

  • An SMB server configured to listen to the port you want to use

Map an alternative port

To map an alternative port to your SMB client:

PowerShell

  1. Open an elevated PowerShell window as an administrator.

  2. Run one of the following commands to map a port:

    • Run this command to map a TCP port:

      New-SmbMapping -LocalPath <drive letter>: -RemotePath \\server\share -TcpPort <port number between 0 and 65536>
      
    • Run this command to map a QUIC port:

      New-SmbMapping -LocalPath <drive letter>: -RemotePath \\server\share -QuicPort <port number between 0 and 65536>
      
    • Run this command to map an RDMA port:

      New-SmbMapping -LocalPath <drive letter>: -RemotePath \\server\share -RdmaPort <port number between 0 and 65536>
      

Command line

  1. Open an elevated command-line prompt as an administrator.

  2. Run one of the following commands to map a port:

    • Run this command to map a TCP port:

      NET USE <drive letter>: \\server\share /TCPPORT:<port number between 0 and 65536>
      
    • Run this command to map a QUIC port:

      NET USE <drive letter>: \\server\share /QUICPORT:<port number between 0 and 65536>
      
    • Run this command to map an RDMA port:

      NET USE <drive letter>: \\server\share /RDMAPORT:<port number between 0 and 65536>
      

Control or block alternative port usage

The SMB server in Windows and Windows Server only supports changing the SMB over QUIC listening port. You can't configure TCP or RDMA listening ports.

The only method currently available to configure alternative ports is through PowerShell. You can configure the SMB over the QUIC server to use an alternative port by running the following commands:

#Lists all available alternative ports
Get-SmbServerAlternativePort 

#Creates a new alternative port
New-SmbServerAlternativePort -TransportType QUIC -Port <port number> -EnableInstances Default

#Deletes an alternative port
Remove-SmbServerAlternativePort

#Configures SMB to use a specific port
Set-SmbServerAlternativePort

Related content

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 10/25/2024
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

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

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