Set-LogProperties

Changes the properties of a Windows event log.

Syntax

Set-LogProperties
   [-LogDetails] <LogDetails>
   [-Force]
   [<CommonParameters>]

Description

This cmdlet is only available on the Windows platform.

This cmdlet changes the configuration settings of a Windows event log. This cmdlet is used by the Enable-PSTrace and Disable-PSTrace cmdlets.

You must run this cmdlet from an elevated PowerShell session.

Examples

Example 1: Change the retention setting of the Windows PowerShell event log

$logDetails = Get-LogProperties 'Windows PowerShell'
$logDetails.Retention = $True
Set-LogProperties -LogDetails $logDetails
Get-LogProperties 'Windows PowerShell'

Name       : Windows PowerShell
Enabled    : True
Type       : Admin
Retention  : True
AutoBackup : False
MaxLogSize : 15728640

Parameters

-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

-LogDetails

The updated configuration settings to be assigned to the event log.

Type:Microsoft.PowerShell.Diagnostics.LogDetails
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

Inputs

Microsoft.PowerShell.Diagnostics.LogDetails

You can pipe a fully configured LogDetails object to this cmdlet. Therefore, to change one setting, you should use Get-LogProperties to retrieve the current configuration.

Outputs

None

This cmdlet returns no output.

Notes

You must run this cmdlet from an elevated PowerShell session.