Summary:

This article contains the current Remote Desktop Server client disconnect codes and reasons. These events are logged on the machine hosting the Remote Desktop Session. Please see parent article Remote Desktop Services RDS Logon Connectivity Overview for additional information.

More Information:

The Remote Desktop Server RDP client disconnect codes are written to the 'Microsoft-Windows-TerminalServices-LocalSessionManager/Operational' event log in 'Applications and Services Logs/Microsoft/Windows' in Event Viewer. When troubleshooting RDP client connections, be aware that depending on the configuration such as encryption and security level, the client may attempt connection multiple times and disconnect before the final connection is made.

Example Event from Event Log:

Log Name:      Microsoft-Windows-TerminalServices-LocalSessionManager/Operational
Source:        Microsoft-Windows-TerminalServices-LocalSessionManager
Date:          5/4/2017 10:49:19 AM
Event ID:      40
Task Category: None
Level:         Information
Keywords:     
User:          SYSTEM
Computer:      server-machine
Description:
Session 12 has been disconnected, reason code 5
Event Xml:
  <System>
    <Provider Name="Microsoft-Windows-TerminalServices-LocalSessionManager" Guid="{5D896912-022D-40AA-A3A8-4FA5515C76D7}" />
    <EventID>40</EventID>
    <Version>0</Version>
    <Level>4</Level>
    <Task>0</Task>
    <Opcode>0</Opcode>
    <Keywords>0x1000000000000000</Keywords>
    <TimeCreated SystemTime="2017-05-04T14:49:19.967158000Z" />
    <EventRecordID>415</EventRecordID>
    <Correlation ActivityID="{F4204A84-0FBC-4C56-820E-9469A7650000}" />
    <Execution ProcessID="1076" ThreadID="11880" />
    <Channel>Microsoft-Windows-TerminalServices-LocalSessionManager/Operational</Channel>
    <Computer>server-machine</Computer>
    <Security UserID="S-1-5-18" />
  </System>
  <UserData>
    <EventXML xmlns="Event_NS">
      <Session>12</Session>
      <Reason>5</Reason>
    </EventXML>
  </UserData>
</Event>

RDS Session Host Server Disconnect Codes:


RDS server client disconnect code

Disconnect reason

0x00000001

The disconnection was initiated by an administrative tool on the server in another session.

0x00000002

The disconnection was due to a forced logoff initiated by an administrative tool on the server in another session.

0x00000003

The idle session limit timer on the server has elapsed.

0x00000004

The active session limit timer on the server has elapsed.

0x00000005

Another user connected to the server, forcing the disconnection of the current connection.

0x00000006

The server ran out of available memory resources.

0x00000007

The server denied the connection.

0x00000009

The user cannot connect to the server due to insufficient access privileges.

0x0000000A (10)

The server does not accept saved user credentials and requires that the user enter their credentials for each connection.

0x0000000B (11)

The disconnection was initiated by the user disconnecting his or her session on the server or by an administrative tool on the server.

0x0000000C (12)

The disconnection was initiated by the user logging off his or her session on the server.



Reference:

MSDN RDP PDU Error Info PDU Codes