Add-PefMessageSource

Add-PefMessageSource

Adds message sources to a PEF Trace Session.

Syntax

Parameter Set: Default
Add-PefMessageSource [-PEFSession] <IPpkTraceSession> [-Source] <Object[]> [-InformationAction <System.Management.Automation.ActionPreference> {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend} ] [-InformationVariable <System.String> ] [-LogConfiguration <String> ] [ <CommonParameters>]

Detailed Description

The Add-PefMessageSource cmdlet adds message sources to a Trace Session. You can specify a file containing message data as a source or use Event Tracing for Windows (ETW) providers for a Protocol Engineering Framework (PEF) Live Trace Session.

Parameters

-InformationAction<System.Management.Automation.ActionPreference>

Specifies how this cmdlet responds to an information event. The acceptable values for this parameter are:

-- SilentlyContinue
-- Stop
-- Continue
-- Inquire
-- Ignore
-- Suspend

Aliases

infa

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-InformationVariable<System.String>

Specifies a variable in which to store an information event message.

Aliases

iv

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-LogConfiguration<String>

Specifies the text log configuration file to use to parse the source data. Specify this parameter if you use text log files as a message source.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PEFSession<IPpkTraceSession>

Specifies an object that contains a Trace Session. To create a Trace Session, use the New-PefTraceSession cmdlet. This cmdlet adds message sources to the session object that this parameter specifies.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-Source<Object[]>

Specifies an array of message provider names.

Aliases

Provider

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

Examples

Example 1: Add a trace file as a message source for a Trace Session

The first command creates a PEF Trace Session object, and then stores it in the $TraceSession01 variable.

The second command adds a saved Microsoft Network Monitor capture file (.cap) as the message source for the Trace Session stored in the $TraceSession01 variable.

The final command starts the Trace Session stored in the $TraceSession01 variable.

C:\PS> $TraceSession01 = New-PefTraceSession
C:\PS> Add-PefMessageSource -PEFSession $TraceSession01 -Source "C:\Captures\UDP10k.cap"
C:\PS> Start-PefTraceSession -PEFSession $TraceSession01

Example 2: Add a PEF message provider to a Trace Session

The first command creates a PEF Trace Session object, and then stores it in the $TraceSession01 variable.

The second command adds the Microsoft-Pef-WFP-MessageProvider as the provider for the Trace Session object stored in the $TraceSession01 variable.

The final command starts the Trace Session stored in the $TraceSession01 variable.

C:\PS> $TraceSession01 = New-PefTraceSession
C:\PS> Add-PefMessageSource -PEFSession $TraceSession01 -Source "Microsoft-Pef-WFP-MessageProvider"
C:\PS> Start-PefTraceSession -PEFSession $TraceSession01

Example 3: Add a manifest-based ETW provider to a Trace Session

The first command creates a PEF Trace Session object, and then stores it in the $TraceSession01 variable.

The second command adds the Microsoft-Windows-Dhcp-Client system ETW provider to the Trace Session object stored in the $TraceSession01 variable.

The final command starts the Trace Session stored in the $TraceSession01 variable.

C:\PS> $TraceSession01 = New-PefTraceSession
C:\PS> Add-PefMessageSource -PEFSession $TraceSession01 -Source "Microsoft-Windows-Dhcp-Client"
C:\PS> Start-PefTraceSession -PEFSession $TraceSession01

Example 4: Add a text log file as a message source for a Live Trace Session

The first command creates a PEF Trace Session object, and then stores it in the $TraceSession01 variable.

The second command adds a saved IIS text log as the message source for the Trace Session stored in $TraceSession01 and uses the LogConfig parameter to specify the configuration file that is required to parse the log.

The final command starts the Trace Session stored in $TraceSession01.

C:\PS> $TraceSession01 = New-PefTraceSession
C:\PS> Add-PefMessageSource -PEFSession $TraceSession01 -Provider "C:\Captures\IIS.log" -LogConfig IIS
C:\PS> Start-PefTraceSession -PEFSession $TraceSession01

New-PefTraceSession

Start-PefTraceSession