0X00000161

Fixing ERROR_MAX_SESSIONS_REACHED (0X00000161)

Windows Errors Intermediate 👁 1 views 📅 May 27, 2026

You hit Windows' session limit. Here's how to kick stale users or raise the cap, from a quick logout to a registry edit.

The 30-second fix: Log off a stale session

What's actually happening here is Windows has a hard limit on concurrent interactive sessions — typically 1 for remote desktop on Windows 10/11, or a configured limit on Windows Server. When you hit that cap, you get error 0X00000161 (ERROR_MAX_SESSIONS_REACHED). The fastest way out is to boot someone else off.

  1. On the machine you're trying to connect to, press Ctrl+Alt+Del and select Task Manager.
  2. Go to the Users tab. You'll see who's logged on — you, maybe a service account, maybe a forgotten session from yesterday.
  3. Right-click the user you want to kick off (not the current local user unless you're sure) and select Sign off. This disconnects their session immediately.

Now try your remote connection again. If that works, you're done. The reason step 3 works is that Windows counts disconnected but not logged-off sessions toward the limit. Signing off cleans that count.

The 5-minute fix: Force disconnect via command line

If you can't get to Task Manager — say you're locked out locally too — use PowerShell or CMD from another admin account, or run it remotely.

From an elevated PowerShell

query session

This lists all sessions on the machine. You'll see IDs like 1, 2, 65536. The one with Disc status is disconnected but still counts. To kill it:

logoff <sessionID>

Replace <sessionID> with the actual ID, e.g., logoff 2. If you get an access denied error, you're not admin on that machine — use runas /user:Administrator first.

From another machine (if RDP is broken)

If you can't even connect, use psexec from Sysinternals:

psexec \\REMOTE_PC -u Administrator cmd /c query session & logoff 2

Replace REMOTE_PC with the hostname or IP. This runs the command remotely. The reason psexec works when RDP fails is it uses SMB and the admin share — a different pipe entirely.

The 15+ minute fix: Increase the session limit (Windows Server only)

If you keep hitting the limit because multiple users legitimately need concurrent RDP access, you can raise the cap. This only applies to Windows Server editions — Windows 10/11 Pro has a hard limit of 1 remote session, and no registry trick will change that. You'd need to switch to Server or use third-party tools like RDP Wrapper.

Via Group Policy (Server 2016/2019/2022)

  1. Open gpedit.msc.
  2. Navigate to Computer Configuration > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Connections.
  3. Double-click Restrict Remote Desktop Services users to a single Remote Desktop Services session — set it to Disabled. This lets a user have multiple sessions.
  4. Double-click Limit number of connections — set it to Enabled, then enter a higher number (like 5 or 10). The default is usually 2 plus the console session.

Run gpupdate /force in an elevated CMD, then restart the Remote Desktop Services service (net stop TermService & net start TermService).

Via Registry (if no GPO)

If Group Policy is locked down by corporate, you can edit the registry directly:

  1. Open regedit as administrator.
  2. Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server.
  3. Find fSingleSessionPerUser. Set it to 0 to allow multiple sessions per user.
  4. Go to HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp.
  5. Find MaxInstanceCount. Set it to the number of concurrent connections you want (e.g., 5). If it doesn't exist, create a DWORD (32-bit) with that name.

Reboot the machine or restart the Terminal Services service for the changes to take effect.

A quick note on Windows 10/11: don't bother with these registry keys for RDP. They're ignored. The session count limit is hardcoded in termsrv.dll. You can patch that DLL (not recommended for production), but the clean workaround is using the RDP Wrapper library — it intercepts the function call that checks the license. That's your only real option on client OSes.

Why this error shows up in practice: Most common on a Windows Server 2019 running as a terminal server, where you have 3 users but only 2 RDP CALs available. Or on a Windows 10 dev box where you left an RDP session open from home, then try connecting from work. The query session command will show that old Disc session eating your slot.

Was this solution helpful?