Reference: Event log data
The following commands are useful for retrieving XML schemas for events you might be interested in subscribing to. You can use the data in the content that is returned from each command to locate information such as the Event Source and Log Path to use when creating a new subscription. Run each line in a PowerShell terminal and substitute the Event IDs and providers you want to investigate.
# List all event providers
Get-WinEvent -ListProvider * | Format-Table
# List all policy-related event providers.
Get-WinEvent -ListProvider *policy* | Format-Table
# List the logs on the machine where the name is like 'policy'
Get-WinEvent -ListLog *policy*
# List all possible event IDs and descriptions for the provider
(Get-WinEvent -ListProvider Microsoft-Windows-GroupPolicy).Events |
Format-Table id, description -AutoSize
# List all of the event log entries for the provider
Get-WinEvent -LogName Microsoft-Windows-GroupPolicy/Operational
# Each event in each provider has its own message data schema.
# Use this line to find the schema of each event ID.
# For a specific event
(Get-WinEvent -ListProvider Microsoft-Windows-GroupPolicy).Events |
Where-Object {$_.Id -eq 5314}
# For a keyword in the event data
(Get-WinEvent -ListProvider Microsoft-Windows-GroupPolicy).Events |
Where-Object {$_.Template -like "*reason*"}
# Find an event ID across all ETW providers:
Get-WinEvent -ListProvider * |
ForEach-Object { $_.Events | Where-Object {$_.ID -eq 4168} }
An example of the data that is returned as a result of running a command:
PS C:\> (Get-WinEvent -ListProvider Microsoft-Windows-GroupPolicy).Events |
Where-Object {$_.Id -eq 5314}
Id : 5314
Version : 0
LogLink : System.Diagnostics.Eventing.Reader.EventLogLink
Level : System.Diagnostics.Eventing.Reader.EventLevel
Opcode : System.Diagnostics.Eventing.Reader.EventOpcode
Task : System.Diagnostics.Eventing.Reader.EventTask
Keywords : {}
Template : <template
xmlns="http://schemas.microsoft.com/win/2004/08/events">
<data name="BandwidthInkbps" inType="win:UInt32"
outType="xs:unsignedInt"/>
<data name="IsSlowLink" inType="win:Boolean"
outType="xs:boolean"/>
<data name="ThresholdInkbps" inType="win:UInt32"
outType="xs:unsignedInt"/>
<data name="PolicyApplicationMode" inType="win:UInt32"
outType="xs:unsignedInt"/>
<data name="ErrorCode" inType="win:UInt32"
outType="win:HexInt32"/>
<data name="LinkDescription" inType="win:UnicodeString"
outType="xs:string"/>
</template>
Description : A %6 link was detected. The Estimated bandwidth is %1 kbps. The
slow link threshold is %3 kbps.
In the following example, "Name" in the output corresponds to the "Event Source" and the "LogLinks" corresponds to "Log Path" when creating a subscription.
PS C:\>Get-WinEvent -ListProvider *policy*
Name : Microsoft-Windows-GroupPolicy
LogLinks : {System, Microsoft-Windows-GroupPolicy/Operational}
Opcodes : {win:Start, win:Stop}
Tasks : {}
Another way of identifying values you can use to create a new subscription is through the Windows Event Viewer. Locate an event and select it to view details.