whi*_*kid 5 windows powershell windows-server-2003 windows-server-2008 windows-event-log
我正在使用 Powershell v2 处理 Windows Server 2003 SP2,并且我正在寻找一种方法来导出一定时间段内的所有系统事件日志(例如,从星期六 2000 小时到星期日 1100 小时)。
我可以使用 Get-Eventlog 命令将所有现有系统日志导出到 CSV 文件,然后复制所述时间窗口中的条目。尽管如此,我正在寻找一种更简单的方法来使用或不使用 powershell。
Get-WinEvent用过滤器修改你的。
$startTime = get-date "5/22/2012 20:00:00"
$endTime = get-date "5/23/2012 11:00:00"
Get-WinEvent -FilterHashtable @{Logname="System"; StartTime=$startTime; EndTime=$endTime} | Export-CSV -Path c:\temp\output.csv
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14854 次 |
| 最近记录: |