ANAVEM
Languagefr
Windows Event Viewer showing system event logs on a monitoring dashboard
Event ID 6145InformationWinLogonWindows

Windows Event ID 6145 – WinLogon: User Logon Session Destroyed

Event ID 6145 indicates a user logon session has been destroyed by the Windows Logon service, typically occurring during normal logoff, system shutdown, or forced session termination.

Emanuel DE ALMEIDAEmanuel DE ALMEIDA
18 March 20269 min read 0
Event ID 6145WinLogon 5 methods 9 min
Event Reference

What This Event Means

Event ID 6145 represents the final stage of user session termination in Windows systems. When WinLogon destroys a user session, it generates this event to document the session cleanup process. The event occurs after all user processes have been terminated and system resources associated with the session have been released.

The event data includes critical forensic information such as the Security ID (SID) of the user whose session was destroyed, the session ID that was terminated, and the logon type that was used to establish the original session. This information proves invaluable for security auditing and compliance reporting.

In Windows 11 and Server 2025 environments, Event ID 6145 has been enhanced with additional context about session destruction reasons, including whether the termination was user-initiated, system-initiated, or administratively forced. The event also correlates with Windows Defender and security subsystem events when session termination occurs due to security policy enforcement.

System administrators should monitor this event alongside related authentication events to maintain comprehensive visibility into user session lifecycles. Unusual patterns in Event ID 6145 generation can indicate security issues, system problems, or policy violations requiring investigation.

Applies to

Windows 10Windows 11Windows Server 2019/2022/2025
Analysis

Possible Causes

  • Normal user logoff through Start menu or Ctrl+Alt+Del
  • System shutdown or restart initiated by user or administrator
  • Administrative session termination using Task Manager or command-line tools
  • Group Policy-enforced session timeout or idle disconnect
  • Remote Desktop session disconnection or termination
  • Fast User Switching between different user accounts
  • System crash recovery cleaning up orphaned sessions
  • Windows Update requiring user session restart
  • Security policy enforcement terminating non-compliant sessions
  • Terminal Services session cleanup on server systems
Resolution Methods

Troubleshooting Steps

01

Review Event Details in Event Viewer

Start by examining the specific details of Event ID 6145 to understand the session termination context.

  1. Open Event Viewer by pressing Win + R, typing eventvwr.msc, and pressing Enter
  2. Navigate to Windows LogsSystem
  3. Filter for Event ID 6145 by right-clicking SystemFilter Current Log
  4. Enter 6145 in the Event IDs field and click OK
  5. Double-click on recent Event ID 6145 entries to examine details
  6. Note the User field showing which account's session was destroyed
  7. Check the Session ID to correlate with other session events
  8. Review the Logon Type to understand the original session type

Use PowerShell to query multiple events efficiently:

Get-WinEvent -FilterHashtable @{LogName='System'; Id=6145} -MaxEvents 50 | Select-Object TimeCreated, Id, LevelDisplayName, Message | Format-Table -AutoSize
02

Correlate with Related Authentication Events

Analyze Event ID 6145 alongside related logon and logoff events to understand the complete session lifecycle.

  1. Query for related authentication events using PowerShell:
# Get session lifecycle events for the last 24 hours
$StartTime = (Get-Date).AddDays(-1)
Get-WinEvent -FilterHashtable @{LogName='Security','System'; Id=4624,4634,4647,6145; StartTime=$StartTime} | Sort-Object TimeCreated | Select-Object TimeCreated, Id, LogName, Message
  1. In Event Viewer, create a custom view:
  2. Right-click Custom ViewsCreate Custom View
  3. Select By log and check both Security and System logs
  4. In the Event IDs field, enter: 4624,4634,4647,6145
  5. Set appropriate time range and click OK
  6. Name the view "Session Lifecycle Events" and save
  7. Review the chronological sequence of events for specific users
  8. Look for patterns indicating forced terminations or unusual session behavior
03

Monitor Session Termination Patterns

Implement monitoring to detect unusual session termination patterns that might indicate security issues or system problems.

  1. Create a PowerShell script to analyze session termination frequency:
# Analyze Event ID 6145 patterns over the last 7 days
$StartTime = (Get-Date).AddDays(-7)
$Events = Get-WinEvent -FilterHashtable @{LogName='System'; Id=6145; StartTime=$StartTime}

# Group by user and count terminations
$UserStats = $Events | ForEach-Object {
    $EventXML = [xml]$_.ToXml()
    $User = $EventXML.Event.EventData.Data | Where-Object {$_.Name -eq 'TargetUserName'} | Select-Object -ExpandProperty '#text'
    [PSCustomObject]@{
        User = $User
        TimeCreated = $_.TimeCreated
        SessionId = ($EventXML.Event.EventData.Data | Where-Object {$_.Name -eq 'SessionId'} | Select-Object -ExpandProperty '#text')
    }
} | Group-Object User | Select-Object Name, Count, @{Name='LastTermination';Expression={($_.Group | Sort-Object TimeCreated -Descending | Select-Object -First 1).TimeCreated}}

$UserStats | Sort-Object Count -Descending
  1. Set up Windows Task Scheduler to run monitoring scripts regularly
  2. Configure Event Log subscriptions for centralized monitoring in enterprise environments
  3. Use Performance Monitor to track session-related counters
  4. Review Group Policy settings that might cause frequent session terminations
04

Investigate Forced Session Terminations

When Event ID 6145 occurs unexpectedly, investigate potential causes of forced session termination.

  1. Check for administrative session termination tools usage:
# Look for process termination events around the same time
$SessionEvent = Get-WinEvent -FilterHashtable @{LogName='System'; Id=6145} -MaxEvents 1
$EventTime = $SessionEvent.TimeCreated
$TimeWindow = 300 # 5 minutes before and after

# Check for process termination events
Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4689; StartTime=$EventTime.AddSeconds(-$TimeWindow); EndTime=$EventTime.AddSeconds($TimeWindow)} | Select-Object TimeCreated, Message
  1. Review system event logs for hardware or driver issues:
# Check for system errors around session termination
Get-WinEvent -FilterHashtable @{LogName='System'; Level=2,3; StartTime=$EventTime.AddMinutes(-10); EndTime=$EventTime.AddMinutes(10)} | Select-Object TimeCreated, Id, LevelDisplayName, ProviderName, Message
  1. Examine Group Policy application logs for policy-enforced terminations
  2. Check Terminal Services logs on server systems for RDP-related terminations
  3. Review Application logs for software that might trigger session cleanup
  4. Analyze network connectivity logs if dealing with remote sessions
05

Configure Advanced Session Monitoring

Implement comprehensive session monitoring to proactively track and analyze Event ID 6145 occurrences.

  1. Enable advanced audit policies for detailed session tracking:
# Configure audit policies via PowerShell
auditpol /set /subcategory:"Logon" /success:enable /failure:enable
auditpol /set /subcategory:"Logoff" /success:enable /failure:enable
auditpol /set /subcategory:"Other Logon/Logoff Events" /success:enable /failure:enable
  1. Configure registry settings for enhanced session logging:
# Enable additional session tracking (requires restart)
New-ItemProperty -Path "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" -Name "AuditBaseObjects" -Value 1 -PropertyType DWORD -Force
New-ItemProperty -Path "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" -Name "FullPrivilegeAuditing" -Value 1 -PropertyType DWORD -Force
  1. Set up Windows Event Forwarding (WEF) for centralized collection:
  2. Create custom event subscriptions targeting Event ID 6145
  3. Configure SIEM integration for automated analysis and alerting
  4. Implement PowerShell-based monitoring with email notifications:
# Monitor for unusual session termination patterns
$Threshold = 10 # Alert if more than 10 terminations per hour
$HourlyCount = (Get-WinEvent -FilterHashtable @{LogName='System'; Id=6145; StartTime=(Get-Date).AddHours(-1)}).Count

if ($HourlyCount -gt $Threshold) {
    # Send alert email or log to monitoring system
    Write-EventLog -LogName Application -Source "Custom Monitor" -EventId 1001 -EntryType Warning -Message "High session termination rate detected: $HourlyCount events in the last hour"
}

Overview

Event ID 6145 fires when the Windows Logon service (WinLogon) destroys a user logon session. This informational event appears in the System log whenever a user session ends through normal logoff, system shutdown, restart, or administrative session termination. The event provides crucial session tracking data including the user account, session ID, and logon type that was terminated.

This event pairs with Event ID 4647 (user-initiated logoff) and Event ID 4634 (account logoff) to provide complete session lifecycle tracking. System administrators rely on Event ID 6145 for user activity auditing, session management troubleshooting, and security investigations involving unauthorized session terminations.

The event contains detailed information about the destroyed session including the target user account, authentication package used, and the reason for session destruction. Understanding this event helps administrators track user behavior patterns, investigate security incidents, and troubleshoot logon-related issues in enterprise environments.

Frequently Asked Questions

What does Event ID 6145 mean and when does it occur?+
Event ID 6145 indicates that the Windows Logon service (WinLogon) has destroyed a user logon session. This informational event occurs whenever a user session ends through normal logoff, system shutdown, restart, or administrative termination. The event provides session tracking data including the user account, session ID, and logon type that was terminated. It's a normal part of the Windows session lifecycle and helps administrators track user activity and troubleshoot session-related issues.
How can I correlate Event ID 6145 with other authentication events?+
Event ID 6145 should be analyzed alongside Event ID 4624 (successful logon), 4634 (account logoff), and 4647 (user-initiated logoff) to understand the complete session lifecycle. Use PowerShell to query multiple event logs simultaneously: Get-WinEvent -FilterHashtable @{LogName='Security','System'; Id=4624,4634,4647,6145} | Sort-Object TimeCreated. Create custom views in Event Viewer that include all these event IDs to see the chronological sequence of session events for forensic analysis and troubleshooting.
Is Event ID 6145 a security concern that requires immediate attention?+
Event ID 6145 is typically an informational event indicating normal session termination and doesn't require immediate security attention. However, unusual patterns like frequent unexpected terminations, sessions ending at odd hours, or multiple rapid terminations for the same user could indicate security issues, system problems, or policy violations. Monitor for patterns rather than individual events, and correlate with other security events to determine if investigation is needed.
How can I distinguish between normal and forced session terminations in Event ID 6145?+
To distinguish between normal and forced terminations, examine the timing and context of Event ID 6145. Normal terminations are preceded by Event ID 4647 (user-initiated logoff) and occur during typical business hours. Forced terminations may lack the 4647 event and could be accompanied by process termination events (Event ID 4689) or system error events. Use PowerShell to analyze the time gaps between related events and check for administrative tools usage or system errors occurring around the same time as the session destruction.
What PowerShell commands help analyze Event ID 6145 patterns effectively?+
Several PowerShell commands help analyze Event ID 6145 patterns: Get-WinEvent -FilterHashtable @{LogName='System'; Id=6145} -MaxEvents 100 retrieves recent events. To analyze patterns by user, parse the event XML to extract user information and group by frequency. Use time-based filtering with StartTime and EndTime parameters to focus on specific periods. For advanced analysis, combine with other event IDs and use Sort-Object TimeCreated to see chronological sequences. Export results with Export-Csv for further analysis in Excel or other tools.
Documentation

References (2)

Emanuel DE ALMEIDA
Written by

Emanuel DE ALMEIDA

Senior IT Journalist & Cloud Architect

Microsoft MCSA-certified Cloud Architect | Fortinet-focused. I modernize cloud, hybrid & on-prem infrastructure for reliability, security, performance and cost control - sharing field-tested ops & troubleshooting.

Discussion

Share your thoughts and insights

You must be logged in to comment.

Loading comments...