How to fix Error 1238 on Windows 11

Why This Error Happens

Error 1238 occurs when a client tries to establish an SMB/network connection to a shared resource on a Windows 11 machine that has already reached its maximum allowed number of simultaneous connections. Windows 11 (like other non-server editions) enforces a hard limit on concurrent inbound SMB sessions (typically 20), and this limit can be reached faster than expected if previous sessions were not properly closed and remain “stale” on the server. It can also happen if the share’s Advanced Sharing settings have been manually configured with a lower simultaneous user limit than needed.

Step-by-Step Resolution Guide

  1. Check active SMB sessions on the host machine (the PC sharing the folder/printer):
  • Open PowerShell as Administrator and run:
    powershell
    Get-SmbSession
  • This lists all current connections, including the client IP and username.
  1. Close stale or unnecessary sessions:
  • Identify sessions that are no longer needed (e.g., from a device that disconnected without logging off properly) and close them:
    powershell
    Get-SmbSession | Where-Object {$_.ClientComputerName -eq "STALE-PC-NAME"} | Close-SmbSession -Force
  • Alternatively, close all sessions and let clients reconnect fresh:
    powershell
    Get-SmbSession | Close-SmbSession -Force
  1. Increase the simultaneous user limit on the shared folder:
  • Right-click the shared folder → Properties → Sharing tab → Advanced Sharing.
  • Under “Limit the number of simultaneous users to,” raise the value (Windows 11 Pro/Home caps out around 20 due to OS licensing limits).
  1. Disconnect unused mapped drives from client machines:
  • On each client connecting to the share, open File Explorer, right-click any mapped network drives no longer in use, and select Disconnect.
  • Or run net use in Command Prompt to view mappings and net use \\server\share /delete to remove ones not needed.
  1. Restart the Server service on the sharing PC to forcibly clear all lingering session states:
   Restart-Service -Name "LanmanServer" -Force

Alternative or Verification Steps

  • After applying the fix, run Get-SmbSession again to confirm the session count is well below the limit, then have the affected client retry the connection.
  • If the issue persists or you regularly need more than 20 concurrent connections, consider migrating the shared resource to a Windows Server edition, which supports unlimited (or much higher) concurrent SMB connections.