# Windows Event IDs and Others for Situational Awareness

Below is a living list of Windows event IDs and other miscellaenous snippets, that may be useful for  situational awareness, once you are on a box:

| Activity                         | Powershell to read event logs for the                                                                                                                                 |                             |                                                                                                                                                    |                             |                    |
| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- | ------------------ |
| **Lock/screensaver**             |                                                                                                                                                                       |                             |                                                                                                                                                    |                             |                    |
| Workstation was locked           | Get-WinEvent -FilterHashtable @{ LogName='security'; Id='4800' }                                                                                                      |                             |                                                                                                                                                    |                             |                    |
| Workstation was unlocked         | Get-WinEvent -FilterHashtable @{ LogName='security'; Id='4801' }                                                                                                      |                             |                                                                                                                                                    |                             |                    |
| Screensaved invoked              | Get-WinEvent -FilterHashtable @{ LogName='security'; Id='4802' }                                                                                                      |                             |                                                                                                                                                    |                             |                    |
| Screensaver dismissed            | Get-WinEvent -FilterHashtable @{ LogName='security'; Id='4803' }                                                                                                      |                             |                                                                                                                                                    |                             |                    |
|                                  |                                                                                                                                                                       |                             |                                                                                                                                                    |                             |                    |
| **System ON/OFF**                |                                                                                                                                                                       |                             |                                                                                                                                                    |                             |                    |
| Windows is starting up           | Get-WinEvent -FilterHashtable @{ LogName='security'; Id='4608' }                                                                                                      |                             |                                                                                                                                                    |                             |                    |
| System uptime                    | Get-WinEvent -FilterHashtable @{ LogName='system'; Id='6013' }                                                                                                        |                             |                                                                                                                                                    |                             |                    |
| Windows is shutting down         | Get-WinEvent -FilterHashtable @{ LogName='security'; Id='4609' }                                                                                                      |                             |                                                                                                                                                    |                             |                    |
| System has been shut down        | Get-WinEvent -FilterHashtable @{ LogName='system'; Id='1074' }                                                                                                        |                             |                                                                                                                                                    |                             |                    |
|                                  |                                                                                                                                                                       |                             |                                                                                                                                                    |                             |                    |
| **System sleep/awake**           |                                                                                                                                                                       |                             |                                                                                                                                                    |                             |                    |
| System entering sleep mode       | Get-WinEvent -FilterHashtable @{ LogName='system'; Id=42 }                                                                                                            |                             |                                                                                                                                                    |                             |                    |
| System returning from sleep      | Get-WinEvent -FilterHashtable @{ LogName='system'; Id='1'; ProviderName = "Microsoft-Windows-Power-Troubleshooter" }                                                  |                             |                                                                                                                                                    |                             |                    |
|                                  |                                                                                                                                                                       |                             |                                                                                                                                                    |                             |                    |
| **Logons**                       |                                                                                                                                                                       |                             |                                                                                                                                                    |                             |                    |
| Successful logons                | Get-WinEvent -FilterHashtable @{ LogName='Security'; Id='4624' }                                                                                                      |                             |                                                                                                                                                    |                             |                    |
| Logons with explicit credentials | Get-WinEvent -FilterHashtable @{ LogName='Security'; Id='4648' }                                                                                                      |                             |                                                                                                                                                    |                             |                    |
| Account logoffs                  | Get-WinEvent -FilterHashtable @{ LogName='security'; Id='4634' }                                                                                                      |                             |                                                                                                                                                    |                             |                    |
|                                  |                                                                                                                                                                       |                             |                                                                                                                                                    |                             |                    |
| **Access**                       |                                                                                                                                                                       |                             |                                                                                                                                                    |                             |                    |
| Outbound RDP                     | Get-WinEvent -FilterHashtable @{ LogName='Microsoft-Windows-TerminalServices-RDPClient/Operational'; id='1024' } \| select timecreated, message \| ft -AutoSize -Wrap |                             |                                                                                                                                                    |                             |                    |
| Inbound RDP                      | <p>Get-WinEvent -FilterHashtable @{ LogName='Microsoft-Windows-TerminalServices-LocalSessionManager/Operational'; id='21' }                                           | select timecreated, message | ft -AutoSize -Wrap</p><p></p><p>Get-WinEvent -FilterHashtable @{ LogName='Microsoft-Windows-RemoteDesktopServices-RdpCoreTS/Operational'; id=131 } | select timecreated, message | ft -AutoSize -Wrap |

</p><p></p><p>Get-WinEvent -FilterHashtable @{ LogName='Microsoft-Windows-TerminalServices-RemoteConnectionManager/Operational'; id='1149' } | ft -AutoSize -Wrap</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| Outbound WinRM                         | <p>Get-WinEvent -FilterHashtable @{ LogName='Microsoft-Windows-WinRM/Operational'; id=6 }</p><p></p><p>Get-WinEvent -FilterHashtable @{ LogName='Microsoft-Windows-WinRM/Operational'; id=80 }</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| Inbound WinRM                          | <p>Get-WinEvent -FilterHashtable @{ LogName='Microsoft-Windows-WinRM/Operational'; id=91 }</p><p></p><p>Get-WinEvent -FilterHashtable @{ LogName='Microsoft-Windows-WMI-Activity/Operational'; id=5857 } | ? {$_.message -match 'Win32_WIN32_TERMINALSERVICE_Prov|CIMWin32'}</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| Inbound Network and Interactive Logons | <p>$events = New-Object System.Collections.ArrayList</p><p></p><p>Get-WinEvent -FilterHashtable @{ LogName='Security'; id=(4624); starttime=(get-date).AddMinutes(-60*24*2) } | % {</p><p>    $event = New-Object psobject</p><p>    $subjectUser = $_.properties[2].value + "\" + $_.properties[1].value</p><p>    $targetUser = $_.properties[6].value + "\" + $_.properties[5].value</p><p>    $logonType = $_.properties[8].value</p><p>    $subjectComputer = $_.properties[18].value</p><p>    if ($logonType -in 3,7,8,9,10,11 -and $subjectComputer -notmatch "::1|-|^127.0.0.1")</p><p>    {</p><p>        switch ($logonType) {</p><p>            3 { $logonType = "Network" }</p><p>            7 { $logonType = "Screen Unlock" }</p><p>            8 { $logonType = "Network Cleartext" }</p><p>            9 { $logonType = "New Credentials" }</p><p>            10 { $logonType = "Remote Interactive" }</p><p>            11 { $logonType = "Cached Interactive" }</p><p>        }</p><p>        $event | Add-Member "Time" $_.TimeCreated</p><p>        $event | Add-Member "Subject" $subjectUser</p><p>        $event | Add-Member "LogonFrom" $subjectComputer</p><p>        $event | Add-Member "LoggedAs" $targetUser</p><p>        $event | Add-Member "Type" $logonType</p><p>        $events.Add($event) | out-null</p><p>    }</p><p>}</p><p></p><p>$events</p> |
| Outbound Network Logons                | <p>$events = New-Object System.Collections.ArrayList</p><p> </p><p>Get-WinEvent -FilterHashtable @{ LogName='Security'; id=(4648); starttime=(get-date).AddMinutes(-60*24*2) } | % {</p><p>    $event = New-Object psobject</p><p>    $subjecUser = $_.Properties[2].Value + "\" + $_.Properties[1].Value</p><p>    $targetUser = $_.Properties[6].Value + "\" + $_.Properties[5].Value</p><p>    $targetInfo = $_.Properties[9].Value</p><p>    $process = $_.Properties[11].Value</p><p> </p><p>    $event | Add-Member "Time" $_.timecreated</p><p>    $event | Add-Member "SubjectUser" $subjecUser</p><p>    $event | Add-Member "TargetUser" $targetUser</p><p>    $event | Add-Member "Target" $targetInfo</p><p>    $event | Add-Member "Process" $process</p><p> </p><p>    if ($targetInfo -notmatch 'localhost')</p><p>    {</p><p>        $events.add($event) | out-null</p><p>    }</p><p>}</p><p> </p><p>$events</p>                                                                                                                                                                                                                                                                                                                                                                                                                                    |
|                                        |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| **Activity**                           |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| Attempt to install a service           | Get-WinEvent -FilterHashtable @{ LogName='Security'; Id='4697' }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| Scheduled task created                 | Get-WinEvent -FilterHashtable @{ LogName='security'; Id='4698' }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| Scheduled task updated                 | Get-WinEvent -FilterHashtable @{ LogName='security'; Id='4702' }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| Sysinternals usage?                    | Get-ItemProperty 'HKCU:\SOFTWARE\Sysinternals\\\*' \| select PSChildName, EulaAccepted                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
|                                        |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| **Security**                           |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| LSASS started as a protected process   | Get-WinEvent -FilterHashtable @{ LogName='system'; Id='12' ; ProviderName='Microsoft-Windows-Wininit' }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
