ETW Encyclopedia - microsoft/MSO-Scripts GitHub Wiki

The MSO-Scripts script-set aims to provide simple command-line tools which harness the power of Event Tracing for Windows (ETW) without requiring deep technical knowledge. Yet, for completeness, we present here an annotated collection of the many tools and techniques for making use of ETW.

Windows Tracing Mechanisms

See also:

ETW Tracing Controllers

See Also:

ETW Trace Log Viewers

See also: Describe Windows Server Event Logs

List Registered ETW Providers

  • Windows Performance Recorder:
    WPR -Providers
  • XPerf:
    XPerf -Providers I
  • LogMan:
    LogMan Providers
  • WEvtUtil:
    WEvtUtil EP
  • PowerShell:
    Get-NetEventProvider -ShowInstalled | Select-Object -Property Name,Guid
  • RegEdit:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Publishers

Detail a Particular ETW Provider

  • LogMan:
    LogMan Providers <Provider Name>
  • WEvtUtil:
    WEvtUtil GP <Provider Name>
  • PowerShell:
    Get-NetEventProvider -ShowInstalled <Provider Name> | Select-Object -Property *

List Running ETW Logging Sessions†

  • User Interface:
    Run: PerfMon.msc
    Data Collector Sets > Event Trace Sessions > dbl-click a session
  • LogMan:
    logman -ets query
    logman -ets query | findstr WPR
  • PowerShell (v5.1+):
    Get-ETWTraceSession -Name *
  • XPerf:
    xperf -Loggers | findstr -v Flags
    xperf -LoggersWithNames

Administrator Privilege Required

Detail a Particular ETW Logging Session†

  • User Interace:
    PerfMon (above) gives the most detailed info on ETW Logging Sessions.
  • LogMan:
    logman -ets query "<Session Name>"
  • PowerShell (v5.1+):
    Get-ETWTraceSession -Name "<Session Name>" | Select-Object -Property *
  • XPerf:
    xperf -LoggersWithNames "<Session Name>"

List AutoLogger Entries†

  • User Interface:
    Run: PerfMon.msc
    Data Collector Sets > Startup Event Trace Sessions > dbl-click a session
  • PowerShell (v5.1+):
    Get-AutoLoggerConfig
  • RegEdit:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\Autologger

AutoLogger entries are disabled when: Start=0

Detail a Particular AutoLogger Entry†

  • User Interace:
    PerfMon (above) gives the most detailed info on AutoLogger entries.
  • PowerShell (v5.1+):
    Get-AutoLoggerConfig "<Config Name>" | Select-Object -Property *

Enable/Disable a Particular AutoLogger Entry†

  • PowerShell (v5.1+):
    Set-AutoLoggerConfig -Name "<Config Name>" -Start 1 or 0

The AutoLogger Start state may be regularly re/set by its originating service.

See: Configuring and Starting an AutoLogger Session

Create a Custom Windows Recording Profile (.WPRP file)

  • Create a Recording Profile from scratch.

  • Modify one of the MSO-Scripts Recording Profiles, found at:
        MSO-Scripts\WPRP\
        MSO-Scripts\BETA\WPRP\

  • Create a custom Recording Profile using 'XPerf -on' notation in PowerShell‡:
        $Env:WPT_PATH="$Env:LocalAppData\MSO-Scripts"
        $Env:WPT_XPERF="Microsoft-Windows-TCPIP + e53c6823-7bb8-44bb-90dc-3f86090d48a6:0x00A4:4:Stack"
        cd MSO-Scripts\
        & { . .\Include.ps1; WPRPFromProviderString $Env:WPT_XPERF }
        Find the custom Recording Profile ! Profile_Name at: $Env:WPT_PATH\WPR_XPERF_Profile.wprp ! AUX_Profile

  • Let MSO-Scripts create a custom Recording Profile (in PowerShell syntax‡, Admin Privilege):
        $Env:WPT_PATH="$Env:LocalAppData\MSO-Scripts"
        $Env:WPT_XPERF="Microsoft-Windows-TCPIP + e53c6823-7bb8-44bb-90dc-3f86090d48a6:0x00A4:4:Stack"
        MSO-Scripts\TraceCPU Start -Lean -Loop -Verbose
        MSO-Scripts\TraceCPU Cancel
        Find the custom Recording Profile ! Profile_Name at: $Env:WPT_PATH\WPR_XPERF_Profile.wprp ! AUX_Profile

  • Export (and modify) a Recording Profile built into WPR with: -ExportProfile
        WPR -Profiles
        WPR -ExportProfile CPU.Verbose <path>\MyCPU.wprp -FileMode

See also:

Trace Windows Start-up

  • MSO-Scripts
        MSO-Scripts\TraceCPU Start -Boot
        shutdown -r -t 0
        MSO-Scripts\TraceCPU Stop -Boot
        MSO-Scripts\TraceCPU View

  • Windows Performance Recorder (WPR) with Built-in Recording Profile‡
        wpr -BootTrace -AddBoot CPU.Verbose -FileMode -InstanceName Trace-CPU.Boot
        shutdown -r -t 0
        wpr -BootTrace -StopBoot "$Env:TEMP\Trace-CPU.Boot.etl" -InstanceName Trace-CPU.Boot
        wpa "$Env:TEMP\Trace-CPU.Boot.etl"

  • Windows Performance Recorder UI (WPRUI)
    Run: wprui > More Options > Choose:

    • Performance Scenario = Boot
    • Detail Level = Verbose (or Light)
    • Logging Mode = File
    • Number of Iterations = 1
    • Resource Analysis: CPU Usage (etc.)
    • Start ...and follow the directions.
    • Finally, choose: Open in WPA
  • On/Off Capture Transition Tool (XBootMgr)‡
        xbootmgr -trace boot -traceflags base+latency+dispatcher -stackwalk profile+cswitch+readythread
            -notraceflagsinfilename -postbootdelay 10 -resultpath $Env:TEMP

    List available Kernel Flags / Groups (for -traceflags):
        xperf -providers K

    Finally, open in WPA:
        wpa "$Env:TEMP\boot_1.etl"

See Also:

Trace Windows Shut-down

  • MSO-Scripts
        $Env:WPT_Mode="Shutdown" or set WPT_Mode=Shutdown
        MSO-Scripts\TraceCPU Start
        shutdown -r -t 0
        MSO-Scripts\TraceCPU Stop
        MSO-Scripts\TraceCPU View

  • Windows Performance Recorder (WPR) with Built-in Recording Profile‡
        wpr -Start CPU.Verbose -Shutdown -FileMode -InstanceName Trace-CPU.Shutdown
        shutdown -r -t 0
        wpr -Stop "$Env:TEMP\Trace-CPU.Shutdown.etl" -InstanceName Trace-CPU.Shutdown
        wpa "$Env:TEMP\Trace-CPU.Shutdown.etl"

  • Windows Performance Recorder UI (WPRUI)
    Run: wprui > More Options > Choose:

    • Performance Scenario = Shutdown
    • Detail Level = Verbose (or Light)
    • Logging Mode = File
    • Number of Iterations = 1
    • Resource Analysis: CPU Usage (etc.)
    • Start ...and follow the directions.
    • Finally, choose: Open in WPA
  • On/Off Capture Transition Tool (XBootMgr)‡
        xbootmgr -trace shutdown -traceflags base+latency+dispatcher -stackwalk profile+cswitch+readythread
            -notraceflagsinfilename -noprepreboot -resultpath $Env:TEMP

    List available Kernel Flags / Groups (for -traceflags):
        xperf -providers K

    Finally, open in WPA:
        wpa "$Env:TEMP\shutdown_1.etl"

‡ A Note on Environment Variables

Commands herein use PowerShell format.

PowerShell: $Env:TEMP
CMD Window: "%TEMP%"

PowerShell:   $Env:WPT_Mode="Shutdown"
CMD Window: set WPT_Mode=Shutdown

⚠️ **GitHub.com Fallback** ⚠️