清除Windows 7事件日志

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了清除Windows 7事件日志相关的知识,希望对你有一定的参考价值。

This is a simple batch script to clear the event logs from a windows 7 or server 2008 machine. The script does *not* save these logs. This was tested on a local machine but could be adapted for remote use.
  1. @echo off
  2. @cls
  3. ::Tested on a local machine using Windows 7 x64 Home Premium
  4. ::Use the ping command to wait -n # seconds; change # for time to wait
  5. ::Basic code can be found in various places on the internet
  6. ::Modified by Rectifier 06-30-2012
  7.  
  8. ::If you receive an error try running the batch file as an administrator
  9. ::Note that the event log has to be enabled to begin with or this is a fairly useless batch
  10.  
  11. ::Make readable prompt
  12. echo. & echo. & echo.
  13. echo Clearing event logs...
  14. ::Clear event logs by searching for them using a for loop
  15. @for /f %%i in ( 'wevtutil el' ) do wevtutil cl "%%i" >NUL 2>&1
  16. ::Clear event logs not found by the for loop
  17. wevtutil.exe cl "Microsoft-Windows-Diagnosis-DPS/Operational"
  18. wevtutil.exe cl "Microsoft-Windows-User Profile Service/Operational"
  19. wevtutil.exe cl "Microsoft-Windows-Windows Defender/Operational"
  20. wevtutil.exe cl "Microsoft-Windows-Windows Defender/WHC"
  21. wevtutil.exe cl "Microsoft-Windows-Windows Firewall With Advanced Security/Firewall"
  22. wevtutil.exe cl System
  23. ::Informing the batch is finished executing
  24. echo Batch finished!
  25. ping 127.0.0.1 -n 3 | find "Reply" > nul

以上是关于清除Windows 7事件日志的主要内容,如果未能解决你的问题,请参考以下文章

保存(并清除)Windows事件日志

在 Windows 7 事件日志中,啥是“源”?

安装oracle11的时候 提示ORA-28056 未能将审计记录写入windows事件日志,这是怎么回事啊

片段中的Tablayout + viewpager,需要清除viewpager中的edittext数据

easylogging++:在应用程序启动时清除日志文件

如何获取事件日志 Web3.py?