Set-LogProperties
Changes the properties of a Windows event log.
Syntax
Default (Default)
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.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-LogDetails
The updated configuration settings to be assigned to the event log.
Parameter properties
| Type: | Microsoft.PowerShell.Diagnostics.LogDetails |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | 0 |
| Mandatory: | True |
| Value from pipeline: | True |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -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.