Set-LogProperties
更改 Windows 事件日志的属性。
语法
Default (默认值)
Set-LogProperties
[-LogDetails] <LogDetails>
[-Force]
[<CommonParameters>]
说明
此 cmdlet 仅在 Windows 平台上可用。
此 cmdlet 更改 Windows 事件日志的配置设置。 此 cmdlet 由 Enable-PSTrace 和 Disable-PSTrace cmdlet 使用。
必须从权限提升的 PowerShell 会话中运行此 cmdlet。
示例
示例 1:更改 Windows PowerShell 事件日志的保留设置
$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
参数
-Force
用于在不提示的情况下强制更改。
参数属性
| 类型: | SwitchParameter |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-LogDetails
要分配给事件日志的更新配置设置。
参数属性
| 类型: | Microsoft.PowerShell.Diagnostics.LogDetails |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | 0 |
| 必需: | True |
| 来自管道的值: | True |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
CommonParameters
此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters。
输入
Microsoft.PowerShell.Diagnostics.LogDetails
可以通过管道将完全配置的 LogDetails 对象传递给此 cmdlet。 因此,若要更改一个设置,应使用 Get-LogProperties 来检索当前配置。
输出
None
此 cmdlet 不返回任何输出。
备注
必须从权限提升的 PowerShell 会话中运行此 cmdlet。