Audit process creation events

Using standard Windows auditing mechanisms, you can log all process creation events. This also works in the Home editions of Windows.

  1. Enable auditing for process creation events:
    %windir%\system32\auditpol.exe /set /subcategory:"Process Creation" /success:enable /failure:enable
  2. Enable the Include command line in process creation events feature:
    Windows Registry Editor Version 5.00

Every log message will contain this very verbose explanation:

Token Elevation Type indicates the type of token that was assigned to the new process in accordance with User Account Control policy.

Type 1 is a full token with no privileges removed or groups disabled.  A full token is only used if User Account Control is disabled or if the user is the built-in Administrator account or a service account.

Type 2 is an elevated token with no privileges removed or groups disabled.  An elevated token is used when User Account Control is enabled and the user chooses to start the program using Run as administrator.  An elevated token is also used when an application is configured to always require administrative privilege or to always require maximum privilege, and the user is a member of the Administrators group.

Type 3 is a limited token with administrative privileges removed and administrative groups disabled.  The limited token is used when User Account Control is enabled, the application does not require administrative privilege, and the user does not choose to start the program using Run as administrator.

This is particularly distracting when querying the event log from PowerShell. This PowerShell function therefore removes this explanation from each message:

function Get-ProcessAuditEvents {
        $MaxEvents = [long]::MaxValue

    Get-WinEvent -MaxEvents $MaxEvents -FilterHashtable @{
        LogName = 'Security';
        Id = 4688;
    } | ForEach-Object -Process {
        $_.Message = [regex]::Replace( $_.Message, '(\s+)Token Elevation Type indicates(.+)$', '', 'Singleline' );
        $_.Message = [regex]::Replace( $_.Message, 'Token Elevation Type:\s+%%(\d+)', {
            $line = $match.Groups[0];
            $explain = switch( $match.Groups[1].Value ) {
                '1936' { 'Full token'; }
                '1937' { 'Elevated token'; }
                '1938' { 'Limited token'; }
            return "$line ($explain)";
        $_.Message = [regex]::Replace( $_.Message, '(Process ID:\s+)0x([a-f0-9]+)', {
            $header = $match.Groups[1].Value;
            $id = [int32]::Parse(
            return "$header$id";
        return $_;

Additionally, the function will convert hexadecimal process IDs to the more familiar decimal notation. Use the function as follows:

PS> Get-ProcessAuditEvents -MaxEvents 1 | Format-List -Property TimeCreated, Message

TimeCreated : 2023-04-22 05:37:41
Message     : A new process has been created.

              Creator Subject:
                Security ID:            S-1-5-21-574766472-1934979887-525962139-1009
                Account Name:           Admin
                Account Domain:         DESKTOP-BHAKPDJ
                Logon ID:               0x11A9F9

              Target Subject:
                Security ID:            S-1-0-0
                Account Name:           -
                Account Domain:         -
                Logon ID:               0x0

              Process Information:
                New Process ID:         7032
                New Process Name:       C:\Windows\System32\notepad.exe
                Token Elevation Type:   %%1937 (Elevated token)
                Mandatory Label:                S-1-16-12288
                Creator Process ID:     7940
                Creator Process Name:   C:\Windows\System32\cmd.exe
                Process Command Line:   "C:\Windows\System32\notepad.exe" C:\windows\system32\drivers\etc\hosts

You can also easily filter the events:

PS> Get-ProcessAuditEvents -MaxEvents 100 | Where-Object -Property 'Message' -Match -Value 'notepad' | Format-List