Set-LogProperties
變更 Windows 事件記錄檔的屬性。
語法
Default (預設值)
Set-LogProperties
[-LogDetails] <LogDetails>
[-Force]
[<CommonParameters>]
Description
此 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。