Windows event log · Microsoft-Windows-TerminalServices-LocalSessionManager/Operational40 Session (PayloadData1) has been disconnected, reason code (PayloadData2)
- Remote access
- 2 fields
Microsoft-Windows-TerminalServices-LocalSessionManager%4Operational.evtxMicrosoft-Windows-TerminalServices-LocalSessionManager
Fields EvtxECmd extracts
2 columns in the EvtxECmd CSV
- PayloadData1
Session: %Session%- %Session% = /Event/UserData/EventXML/Session
- PayloadData2
Reason: %Reason%- %Reason% = /Event/UserData/EventXML/Reason
Value lookups
Codes that EvtxECmd turns into text
Reason
- 0
- No additional information is available (i.e. the user has closed RDP window)
- 1
- The disconnection was initiated by an administrative tool on the server in another session
- 2
- The disconnection was due to a forced logoff initiated by an administrative tool on the server in another session
- 3
- The idle session limit timer on the server has elapsed
- 4
- The active session limit timer on the server has elapsed
- 5
- The client's connection was replaced by another connection (i.e. a user reconnected to a previous RDP session)
- 6
- The server ran out of available memory resources
- 7
- The server denied the connection
- 9
- The user cannot connect to the server due to insufficient access privileges
- 10
- The server does not accept saved user credentials and requires that the user enter their credentials for each connection
- 11
- The disconnection was initiated by the user disconnecting his or her session on the server or by an administrative tool on the server
- 12
- The disconnection was initiated by the user logging off his or her session on the server
Sample event
Event XML from the map file
<Event
<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="2019-08-05T18:29:24.930754500Z"/>
<EventRecordID>732</EventRecordID>
<Correlation ActivityID="{[GUID]}"/>
<Execution ProcessID="1200" ThreadID="1056"/>
<Channel>Microsoft-Windows-TerminalServices-LocalSessionManager/Operational</Channel>
<Computer>ComputerName</Computer>
<Security UserID="S-1-5-18"/>
</System>
<UserData>
<EventXML xmlns="Event_NS">
<Session>2</Session>
<Reason>5</Reason>
</EventXML>
</UserData>
</EventReferences
5 links
- ponderthebits.com/2018/02/windows-rdp-related-event-logs-identification-tracking-and-investigation/(opens in new tab)
- social.technet.microsoft.com/wiki/contents/articles/37874.rds-session-host-server-disconnect-codes.aspx(opens in new tab)
- woshub.com/rdp-connection-logs-forensics-windows/(opens in new tab)
- community.spiceworks.com/topic/550908-terminal-services-disconnections-reason-codes(opens in new tab)
- github.com/nasbench/EVTX-ETW-Resources/blob/main/ETWProvidersCSVs/Internal/Microsoft-Windows-TerminalServices-LocalSessionManager.csv(opens in new tab)
Source: evtx/Maps/Microsoft-Windows-TerminalServices-LocalSessionManager-Operational_Microsoft-Windows-TerminalServices-LocalSessionManager_40.map(opens in new tab) by Troy Larson and contributors(opens in new tab), MIT License(opens in new tab)