Step 1: Turn on logon auditing
- Open the Local Group Policy Editor. Type
gpedit.mscin the search box and pressEnter. - Go to Computer Configuration, Windows Settings, Security Settings, Local Policies, Audit Policy.
- Double-click Audit logon events.
- Tick Success and Failure and click OK.
- Close the editor.
(On newer servers you can use Advanced Audit Policy Configuration, then Logon/Logoff, then Audit Logon.)
Step 2: Open Event Viewer
- Click the Start menu and type
Event Viewer. - Click Event Viewer in the results.
- Expand Windows Logs.
- Click Security.
Step 3: Filter the logon events
- In the Security log, click Filter Current Log in the Actions pane on the right.
- In the dialog, choose Microsoft Windows security auditing as the event source (in some versions, open Event sources).
- Tick Audit Success and Audit Failure under Keywords.
- In User, type a name to see the events of one user.
- Click OK.
Only successful logons
- Open the Security log and click Filter Current Log.
- Choose Microsoft Windows security auditing as the source.
- Tick Audit Success in Keywords.
- Type
4624in Event IDs. - Type the user name in User if you want one user.
- Click OK.
Useful event IDs
| Event ID | Meaning |
|---|---|
| 4624 | A successful logon |
| 4625 | A failed logon |
| 4634 | A logoff |
| 4647 | A user started a logoff |
| 4648 | A logon with explicit credentials |
| 4672 | Special privileges assigned to a new logon |
Look at the Logon Type inside an event: type 2 is local, type 3 is network, and type 10 is Remote Desktop.
Use PowerShell
To list the last 20 failed logons:
Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4625} -MaxEvents 20
What to look for
- Many failed logons (4625) in a short time, which can mean a brute-force attack.
- Logons at odd hours.
- Logons from unknown IP addresses (shown in the event details).
Quick recap
- Turn on Audit logon events (success and failure).
- Filter the Security log in Event Viewer for 4624 and 4625.
- Watch for many failed logons.