Forked from mattifestation/process_image_logging.ps1
Created
January 31, 2019 20:35
-
-
Save sasqwatch/ba1262070b6291e4890297911d6c4a8a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# These values were obtained from: logman query providers Microsoft-Windows-Kernel-Process | |
$WINEVENT_KEYWORD_PROCESS = 0x10 | |
$WINEVENT_KEYWORD_IMAGE = 0x40 | |
# Normally when you enable an analytic log, all keywords are logged which can be veeeeerrrrryy noisy. | |
# I'm going to limit collection to only image and process event | |
$KernelProcessLog = New-Object -TypeName System.Diagnostics.Eventing.Reader.EventLogConfiguration -ArgumentList 'Microsoft-Windows-Kernel-Process/Analytic' | |
$KernelProcessLog.ProviderKeywords = ($WINEVENT_KEYWORD_PROCESS -bor $WINEVENT_KEYWORD_IMAGE) | |
$KernelProcessLog.ProviderLevel = 0xFF | |
$KernelProcessLog.IsEnabled = $true | |
# Enable the log with the settings we specified | |
$KernelProcessLog.SaveChanges() | |
# Retrieve process start/stop and image/unload load events | |
Get-WinEvent -LogName 'Microsoft-Windows-Kernel-Process/Analytic' -Oldest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment