Enable-PSTrace

Enables the Microsoft-Windows-PowerShell event provider logs.

Syntax

Enable-PSTrace
      [-Force]
      [-AnalyticOnly]
      [<CommonParameters>]

Description

This cmdlet is only available on the Windows platform.

This cmdlet enables the Operational and Analytic event logs of the Microsoft-Windows-PowerShell event provider.

You must run this cmdlet from an elevated PowerShell session.

Examples

Example 1: Enable the Analytic event log for PowerShell

The following example enables only the Analytic event log of the Microsoft-Windows-PowerShell provider.

Enable-PSTrace -AnalyticOnly

Parameters

-AnalyticOnly

When this parameter is used, the cmdlet enables the Analytic event log of the Microsoft-Windows-PowerShell provider. The Operational event log is not changed.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Force

Used to force the change without prompting.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

You can't pipe objects to this cmdlet.

Outputs

None

This cmdlet returns no output.

Notes

This cmdlet uses the Get-LogProperties and Set-LogProperties cmdlets.

You must run this cmdlet from an elevated PowerShell session.