iT邦幫忙

0

事件檢視器匯出

想請問一下各位前輩
要如何將事件檢視器記錄檔匯出?
如何將匯出的檔案壓縮成ZIP檔案?

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

0
蟹老闆
iT邦大師 1 級 ‧ 2018-09-19 04:45:56

請參考

@Echo Off
fsutil dirty query %SystemDrive%>Nul 2>Nul||(Echo.&Echo.&Echo 注意!動作未完成,請用右鍵以系統管理員身分執行&Echo.&Echo.&Echo.&Echo.&Pause&Exit)
SetLocal ENABLEDELAYEDEXPANSION
Set ArhivePath=%~pd0\EventBackup\
Set LogDate=%DATE:/=-%
If Not Exist "%ArhivePath%" MD "%ArhivePath%"
For /f "delims=*" %%i in ('WevtUtil el') do (
    Set NC=%%i
    Set Alias=!NC:/=@!
    WevtUtil epl "!NC!" "%ArhivePath%!Alias!.evtx"
)
Powershell Compress-Archive -Path "%ArhivePath%*" -CompressionLevel optimal -DestinationPath "%~pd0EventBackup%LogDate: =%"
Echo.&Echo.&Echo.&Echo.&Echo.&Echo.
Echo.		按下任一鍵將會刪除暫存資料
Pause
RD /S /Q "%ArhivePath%"

windows CMD 下實在沒什麼好用的壓縮工具,借助 PowerShell 可以得到較佳的效果。

我要發表回答

立即登入回答