Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

New-WinEvent

New-WinEvent

microsoft.powershell.commands.diagnostics.dll

Synopsis

Creates a new Windows event for the specified event provider.

Syntax

New-WinEvent [-ProviderName] [-Id] [-Payload] [-Version] [<CommonParameters>]

Detailed Description

The New-WinEvent cmdlet creates an Event Tracing for Windows (ETW) event for an event provider. You can use this cmdlet to add events to ETW channels from Windows PowerShell.

Parameters

-Id <Int32>

Specifies an event id that was registered through an instrumentation manifest.

Aliases

None

Required?

true

Position

2

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-Payload <Object[]>

Specifies the message for the event. When the event is written to an event log, the payload is stored in the Message property of the event object.

When the specified payload does not match the payload in the event definition, Windows PowerShell generates a warning, but the command still succeeds.

Aliases

None

Required?

false

Position

3

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-ProviderName <String>

Specifies the event provider that writes the event to an event log, such as "Microsoft-Windows-PowerShell". An ETW event provider is a logical entity that writes events to ETW sessions.

Aliases

None

Required?

true

Position

1

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-Version <Byte>

Specifies the version number of the event. Type the event number. Windows PowerShell converts the number to the required Byte type.

This parameter lets you specify an event when different versions of the same event are defined.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

Input Type

None

Return Type

None

Notes

After the provider writes the even to an eventlog, you can use the Get-WinEvent cmdlet to get the event from the event log.

For information about Event Tracing for Windows, see "Improve Debugging And Performance Tuning With ETW" in MSDN Magazine at http://msdn.microsoft.com/en-us/magazine/cc163437.aspx.

Examples

Example 1

This command uses the New-WinEvent cmdlet to create event 45090 for the Microsoft-Windows-PowerShell provider.

PS C:\>New-WinEvent -ProviderName Microsoft-Windows-PowerShell -Id 45090 -Payload @("Workflow", "Running")

Online Version
Get-WinEvent