PowerShell-取得上一個月的事件錯誤記錄
最近要將每月的報告自動化,所以使用PowerShell來取得一些記錄,要取得的記錄是事件檢視器前一個月的「應用程式」、「安全性」、「系統」各個的錯誤事件。 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647$month = Get-Date -Format 'MM'$year = Get-Date -Format 'yyyy'$dir = 'EventLog'if($month -eq 1){ $year = $year-1 $month = 12}else{ $month = $month-1} $last = [DateTime]::DaysInMonth($year, $month)$first = Get-Date -Day 1 -Month $month -Year $year -Hour 0 -Minute 0 -Second...





