Event ID 4634: logoff
What Event ID 4634 (logoff) means, the fields to check, what is normal and what is suspicious, with PowerShell and KQL queries to find it.
Event ID 4634 records an account logging off. On its own it tells you little, but paired with the 4624 that has the same Logon ID it gives you the length of a session, which helps size what an attacker could have done with it.
The fields that matter
| Field | What it tells you |
|---|---|
| Subject > Account Name | Who logged off. |
| Logon ID | Match this with the 4624 Logon ID. |
| Logon Type | Same meaning as in 4624. |
What is normal
Network logons (type 3) logging off seconds after they start, and interactive sessions ending at the end of the day.
When Event ID 4634 is suspicious
- An RDP or admin session that lasted far longer than normal.
- Many short type 3 sessions from one source across many hosts: tooling moving laterally.
Common false positive: Network logons are short-lived by design and produce huge volumes of 4634.
Find Event ID 4634 with PowerShell
Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4634; StartTime=(Get-Date).AddDays(-7)} -MaxEvents 50 |
ForEach-Object {
$d = [ordered]@{ Time = $_.TimeCreated; Computer = $_.MachineName }
([xml]$_.ToXml()).Event.EventData.Data | ForEach-Object { $d[$_.Name] = $_.'#text' }
[pscustomobject]$d
} | Format-List
Microsoft Sentinel (KQL)
SecurityEvent
| where TimeGenerated > ago(7d) and EventID == 4634
| project TimeGenerated, Computer, Account, Activity, EventData
| order by TimeGenerated desc
Related events
- Event ID 4624: Successful logon
- Event ID 4647: User-initiated logoff
- Event ID 4779: Session disconnected from a window station
FAQ
Why is there no 4634 for some logons?
Logoff events are not guaranteed: a crash or power loss leaves none, and some network logons are closed without one.
Windows Event Triage reads a CSV, EVTX-to-JSON or XML export in your browser and flags brute force, new admins, suspicious services and log clearing.
IOC Triage, our free browser extension: right-click it for a verdict from 15 threat-intel sources, then copy a ready ticket note.