Forked from mattifestation/process_image_logging.ps1
Created
February 1, 2019 12:50
-
-
Save lctrcl/9c11e0e9a1e91913e3f9a82e5ac3a1e5 to your computer and use it in GitHub Desktop.
This file contains 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