PowerShell에서 날짜별로 Windows Eventlog 항목 가져오기

PowerShell에서 날짜별로 Windows Eventlog 항목 가져오기

날짜 범위를 기준으로 PowerShell에서 이벤트 로그를 필터링하려고 합니다. 명령을 실행하면 입력한 항목 유형별로 모든 이벤트 로그가 표시됩니다. 내가 도대체 ​​뭘 잘못하고있는 겁니까?

Get-EventLog -LogName System -EntryType Error -Before 12/1/19 -After 12/3/19

답변1

윈도우 10 64비트. 파워쉘 5.

귀하의 질문 논리에 따르면 12/02를 제외한 항목을 원하지만 귀하의 질문이 잘못된 경우를 대비해 두 가지 방법을 포함하고 있습니다.

특정 날짜별 powershell get-eventlog:

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

관련 정보