| 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 |
Changes the properties of a Windows event log.
Set-LogProperties [-LogDetails] <LogDetails> [-Force] [<CommonParameters>]
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.
$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
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: FalseThe 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: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
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.
This cmdlet returns no output.
You must run this cmdlet from an elevated PowerShell session.