Show Recent Windows Logon Events (Security event 4624)
List the latest successful sign-ins recorded in the Windows Security event log with PowerShell.
01Command
$ Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4624} -MaxEvents 10 | Select-Object TimeCreated, @{n='Account';e={$_.Properties[5].Value}}, @{n='Type';e={$_.Properties[8].Value}}02What it does
Every successful sign-in — local keyboard, RDP, network and service logons — writes a 4624 event to the Security log, and this query pulls the newest ten. The Logon Type field tells you how: 2 is interactive (someone at the keyboard), 10 is Remote Desktop, 3 is a network share access. Regular 4624 entries at odd hours for accounts you do not recognize are worth investigating.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- 4624(S): An account was successfully logged onEvidence: Defines Windows security event 4624 for successful logons and documents its fields, including Account Name (index 5) and Logon Type (index 8).
Last verified: 2026-09-18 · Category: Security & Privacy
06Related solutions
Read the Authenticode signature status and signer of any executable or script in PowerShell.
Understand PowerShell's execution policy scopes and set the one that lets you run your own local scripts without gutting the security model.
Search inside text files and logs with regex, returning file, line number and match.