Skip to content

Set-LogProperties

SYNOPSIS

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: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: 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
Parameter Sets: (All)
Aliases:

Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

Microsoft.PowerShell.Diagnostics.LogDetails

You must pass a fully configured LogDetails object to the `Set-LogProperties` cmdlet. Therefore, to change one setting, you should use `Get-LogProperties` to retrieve the current configuration.

OUTPUTS

None

NOTES

You must run this cmdlet from an elevated PowerShell session.

Get-LogProperties

Enable-PSTrace

Disable-PSTrace

Back to top