Skip to content

Sysmon

75 commands

Microsoft Sysinternals System Monitor: logs process creation, network connections, file changes and more to the Windows (and Linux) event log.

  • Windows
  • event logging
  • detection

Install Sysmon

sudo apt install sysmonforlinux

Basic Help2

sysmon -?

Displays the basic usage help menu and command line switches for the Sysmon utility.

sysmon -? config

Shows help specifically related to configuration file structure and XML schema options.

Schema Information1

sysmon -s

Prints the full supported configuration XML schema for the installed version of Sysmon.

Sysmon Installation5

sysmon -i

Installs the Sysmon driver and service with default settings (Process Create and Process Terminate only).

sysmon -i -n

Installs Sysmon with default settings plus Network Connection monitoring enabled.

sysmon -i -h sha256

Installs Sysmon and configures the hashing algorithm to use SHA256 for image identification.

sysmon -i -h md5,sha256,imphash

Installs Sysmon configured to calculate MD5, SHA256, and IMPHASH for all process images.

sysmon -i config.xml

Installs Sysmon using a specific XML configuration file to define rules and filters.

Configuration Management2

sysmon -c

Dumps the currently active Sysmon configuration and rules to the console output.

sysmon -c new-config.xml

Updates the active Sysmon configuration using a new XML file without reinstalling the service.

Link

Driver Management1

sysmon -d

Sets the name of the Sysmon driver during installation (requires uninstall/reinstall to change).

Link

Advanced Installation1

sysmon -i -l -n

Installs Sysmon with Image Loading (-l) and Network Connection (-n) monitoring enabled.

Link

Service Management2

sc query sysmon

Queries the Windows Service Control Manager to check the running status of the Sysmon service.

Link
sc query sysmon64

Queries the status of the 64-bit Sysmon service explicitly.

Link

Driver Verification1

fltmc instances

Lists loaded filesystem filter drivers to verify the Sysmon driver is attached to volumes.

Link

Log Management2

wevtutil gl Microsoft-Windows-Sysmon/Operational

Gets the configuration details of the Sysmon Operational event log, including size and path.

Link
wevtutil sl Microsoft-Windows-Sysmon/Operational /ms:209715200

Sets the maximum size of the Sysmon Operational log to approximately 200MB.

Link

Event Monitoring (General)1

Get-WinEvent -LogName "Microsoft-Windows-Sysmon/Operational" -MaxEvents 10

Retrieves the 10 most recent events from the Sysmon Operational log using PowerShell.

Link

Process Monitoring2

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=1}

Queries the Sysmon log specifically for Process Creation events (Event ID 1).

Link
Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=5}

Queries for Process Termination events (Event ID 5) to track stopped processes.

Link

File Monitoring3

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=11}

Queries for File Create events (Event ID 11) to detect dropped files.

Link
Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=23}

Queries for File Delete events (Event ID 23), often used for detecting wiping activity.

Link
Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=26}

Queries for File Delete Detected events (Event ID 26) similar to ID 23 but logged via redirect.

Link

Registry Monitoring3

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=12}

Queries for Registry Event Object Create/Delete (Event ID 12).

Link
Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=13}

Queries for Registry Value Set events (Event ID 13) to detect persistence changes.

Link
Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=14}

Queries for Registry Key and Value Rename events (Event ID 14).

Link

Network Monitoring1

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=3}

Queries for Network Connection events (Event ID 3) to trace C2 or lateral movement.

Link

Driver Loading1

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=6}

Queries for Driver Loaded events (Event ID 6) to detect rootkit or BYOVD attacks.

Link

Image Loading1

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=7}

Queries for Image Loaded events (Event ID 7) to see DLLs loaded by processes.

Link

Remote Thread Creation1

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=8}

Queries for CreateRemoteThread events (Event ID 8) to detect code injection.

Link

Raw Access Read1

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=9}

Queries for RawAccessRead events (Event ID 9) often associated with credential dumping.

Link

Process Access1

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=10}

Queries for ProcessAccess events (Event ID 10) to view handle requests like LSASS access.

Link

File Stream1

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=15}

Queries for FileCreateStreamHash events (Event ID 15) to detect Alternate Data Streams (ADS).

Link

Sysmon Configuration Change1

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=16}

Queries for ServiceConfigurationChange events (Event ID 16) to audit Sysmon rule updates.

Link

Named Pipe2

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=17}

Queries for PipeCreated events (Event ID 17) used in Cobalt Strike or lateral movement.

Link
Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=18}

Queries for PipeConnected events (Event ID 18) to trace client connections to pipes.

Link

WMI Monitoring3

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=19}

Queries for WmiEventFilter activity (Event ID 19) to detect WMI persistence.

Link
Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=20}

Queries for WmiEventConsumer activity (Event ID 20) often paired with filters for attacks.

Link
Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=21}

Queries for WmiEventConsumerToFilter activity (Event ID 21) which binds consumer to filter.

Link

DNS Logging1

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=22}

Queries for DNS Query events (Event ID 22) to detect beaconing or malicious domains.

Link

Clipboard Monitoring1

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=24}

Queries for ClipboardChange events (Event ID 24) to see process clipboard capture activity.

Link

Process Tampering1

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=25}

Queries for ProcessTampering events (Event ID 25) identifying 'hollow' or 'herpaderp' images.

Link

File Block1

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=27}

Queries for FileBlockExecutable events (Event ID 27) where Sysmon blocked a file write.

Link

File Shredding1

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=28}

Queries for FileBlockShredding events (Event ID 28) typically related to SDelete activity.

Link

Advanced SOC Workflow2

Get-WinEvent -LogName Microsoft-Windows-Sysmon/Operational | Where-Object {$_.Id -eq 1 -and $_.Message -like "*powershell*"}

Filters recent logs for Process Creation events involving PowerShell to detect script execution.

Link
Get-WinEvent -LogName Microsoft-Windows-Sysmon/Operational | Group-Object Id -NoElement

Provides a summary count of all Sysmon events grouped by Event ID to spot anomalies.

Link

Investigation Workflow2

$Events = Get-WinEvent -LogName Microsoft-Windows-Sysmon/Operational; $Events | Where-Object {$_.Id -eq 3 -and $_.Message -match "DestinationPort: 443"}

Searches for Network Connections over port 443 to correlate HTTPS traffic.

Link
Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=1} | Select-Object -First 5 | Format-List

Displays full details of the last 5 process creation events in a readable list format.

Link

Debug & Troubleshooting3

fltmc

Checks the Filter Manager Control to ensure SysmonDrv is properly registered.

Link
reg query HKLM\SYSTEM\CurrentControlSet\Services\SysmonDrv

Inspects the Registry to verify the Sysmon Driver service configuration.

Link
reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Sysmon/Operational

Inspects the Registry settings for the Sysmon Event Log channel.

Link

Cleanup1

wevtutil cl Microsoft-Windows-Sysmon/Operational

Clears the Sysmon Operational event log, useful when resetting a lab environment.

Link

Uninstallation2

sysmon -u

Uninstalls the Sysmon driver and service cleanly from the system.

Link
sysmon -u force

Forces the uninstallation of Sysmon even if the service is hanging or unresponsive.

Link

Purple Team Validation3

Copy-Item C:\Windows\System32\cmd.exe C:\Temp\mimikatz.exe; Start-Process C:\Temp\mimikatz.exe

Simulates a masquerading attack (renaming cmd.exe) to test OriginalFileName detection in Event ID 1.

Link
nslookup malicious-test-domain.com

Generates a DNS query to validate if Event ID 22 is correctly capturing domain lookups.

Link
New-Item -Path "HKCU:\Software\TestKey" -Value "MaliciousValue"

Creates a registry key to validate if Event ID 12 or 13 is capturing registry modifications.

Link

Detection Logic1

Get-WinEvent -LogName Microsoft-Windows-Sysmon/Operational | Where-Object { $_.Id -eq 1 -and $_.Properties[13].Value -ne $_.Properties[20].Value }

Compares OriginalFileName and current filename in Event ID 1 to detect masquerading programmatically.

Link

Performance Tuning1

Measure-Command { Get-WinEvent -LogName Microsoft-Windows-Sysmon/Operational -MaxEvents 1000 }

Measures the time taken to query Sysmon logs to assess log volume impact on performance.

Link

Manifest Installation1

sysmon -m

Installs the event manifest manually, which can be useful if event logs are not rendering text descriptions.

Link

Advanced Config Export1

sysmon -c > C:\current_sysmon_config.xml

Exports the active configuration to a file for audit or backup purposes.

Link

Parent Process Hunt1

$p = Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=1} -MaxEvents 1; Get-Process -Id $p.Properties[4].Value

Retrieves the ParentProcessId from the latest Sysmon event and looks up the running parent process.

Link

Alternate Stream Hunt1

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=15} | Select-Object -ExpandProperty Message

Reads the message content of FileCreateStreamHash events to identify hidden data streams.

Link

WMI Persistence Hunt1

Get-WinEvent -LogName Microsoft-Windows-Sysmon/Operational | Where-Object { $_.Id -in 19,20,21 } | Format-Table TimeCreated,Id,Message -AutoSize

Aggregates all WMI-related Sysmon events to visualize complete WMI persistence mechanisms.

Link

Obfuscated Install1

sysmon -i config.xml -d mydriver -n

Installs Sysmon with a custom driver name 'mydriver' to obscure its presence from basic checks.

Link

Log Search by Hash1

$hash = 'E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855'; Get-WinEvent -LogName Microsoft-Windows-Sysmon/Operational | Where-Object {$_.Message -match $hash}

Searches the entire Sysmon log history for a specific SHA256 file hash.

Link

Credential Dump Detection1

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=10} | Where-Object {$_.Message -match 'lsass.exe'}

Filters Process Access events specifically targeting lsass.exe, a key indicator of credential dumping.

Link

Archive Log1

wevtutil epl Microsoft-Windows-Sysmon/Operational C:\Evidence\sysmon_backup.evtx

Exports the current Sysmon log to an external EVTX file for offline analysis or evidence preservation.

Link

Automated Config Update1

Invoke-WebRequest -Uri 'https://internal.repo/sysmonconfig.xml' -OutFile 'C:\sysmon.xml'; sysmon -c C:\sysmon.xml

Downloads a remote configuration file and immediately updates the Sysmon configuration.

Link

Sysmon Error Checking1

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=255}

Checks for Sysmon Error events (Event ID 255) which indicate internal Sysmon failures.

Link

Legacy Install Mode1

sysmon -i -accepteula

Installs Sysmon explicitly accepting the EULA (often required in automated non-interactive scripts).

Link

Configuration Validation1

sysmon -t config.xml

Tests a configuration file for syntax errors without loading it (syntax depends on version, often requires dummy load).

Link

Pipe Connection Hunt1

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Sysmon/Operational'; Id=18} | Group-Object -Property Properties -NoElement

Groups pipe connection events to identify high-frequency pipe access which may indicate C2 beacons.

Link

Sysmon Service Restart1

net stop sysmon; net start sysmon

Manually restarts the Sysmon service to clear temporary states or force a reload if hung.

Link

Full Removal1

sysmon -u; sc delete sysmon; del C:\Windows\Sysmon.exe

Performs a manual deep clean of Sysmon artifacts if the uninstaller fails.

Link