Skip to content

Latest commit

 

History

History
115 lines (80 loc) · 2.53 KB

File metadata and controls

115 lines (80 loc) · 2.53 KB
external help file PSDiagnostics-help.xml
Locale en-US
Module Name PSDiagnostics
ms.date 12/12/2022
online version https://learn.microsoft.com/powershell/module/psdiagnostics/set-logproperties?view=powershell-7.6&WT.mc_id=ps-gethelp
schema 2.0.0
title Set-LogProperties

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: None
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 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.

RELATED LINKS

Get-LogProperties

Enable-PSTrace

Disable-PSTrace