我正在嘗試按日期範圍過濾 PowerShell 中的事件日誌。當我運行該命令時,它會按我給出的條目類型顯示每個事件日誌。我究竟做錯了什麼?
Get-EventLog -LogName System -EntryType Error -Before 12/1/19 -After 12/3/19
答案1
Windows 10 64 位元。電源殼 5。
根據您問題的邏輯,您需要 12/02 以外的條目,但我提供了兩種方法,以防您的問題錯誤。
powershell 依特定日期取得事件日誌:
Get-EventLog System -Entrytype Error | Where-Object TimeWritten -Like "12/02/2019*"
或者:
powershell get-eventlog 日期之前和日期之後:
Get-EventLog System -Entrytype Error -Before 12/01/2019 -After 12/03/2019