回复 8# netegg
以下代码可以实现.
删除XP的Windows日志文件(把VBS转AU3了)
$strComputer = "."
$objWMIService = ObjGet("winmgmts:" & "{impersonationLevel=impersonate,(Backup)}!\\" & $strComputer & "\root\cimv2")
Dim $mylogs[3] = ["application","system","security"]
For $logs = 1 To $mylogs
$colLogFiles = $objWMIService.ExecQuery(("Select * from Win32_NTEventLogFile where LogFileName='" & $mylogs[$logs] & "'"))
For $objLogfile In $colLogFiles
$objLogfile.ClearEventLog()
Next
Next
删除Win7的Windows日志文件(把BAT转AU3了)
#include<Process.au3>
_RunDos('wevtutil.exe cl "ACEEventLog"')
_RunDos('wevtutil.exe cl "Application"')
_RunDos('wevtutil.exe cl "HardwareEvents"')
_RunDos('wevtutil.exe cl "Internet Explorer"')
_RunDos('wevtutil.exe cl "Key Management Service"')
_RunDos('wevtutil.exe cl "Media Center"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-API-Tracing/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-AppID/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Application-Experience/Problem-Steps-Recorder"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Application-Experience/Program-Compatibility-Assistant"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Application-Experience/Program-Compatibility-Troubleshooter"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Application-Experience/Program-Inventory"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Application-Experience/Program-Telemetry"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-AppLocker/EXE and DLL"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-AppLocker/MSI and Script"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Audio/CaptureMonitor"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Audio/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Authentication User Interface/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Backup"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-BitLocker-DrivePreparationTool/Admin"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-BitLocker-DrivePreparationTool/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Bits-Client/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Bluetooth-MTPEnum/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-BranchCache/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-BranchCacheSMB/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-CodeIntegrity/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-CorruptedFileRecovery-Client/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-CorruptedFileRecovery-Server/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-DateTimeControlPanel/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-DeviceSync/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Dhcp-Client/Admin"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-DhcpNap/Admin"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Dhcpv6-Client/Admin"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Diagnosis-DPS/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Diagnosis-PCW/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Diagnosis-PLA/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Diagnosis-Scheduled/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Diagnosis-Scripted/Admin"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Diagnosis-Scripted/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Diagnosis-ScriptedDiagnosticsProvider/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Diagnostics-Networking/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Diagnostics-Performance/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-DiskDiagnostic/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-DiskDiagnosticDataCollector/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-DiskDiagnosticResolver/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-DriverFrameworks-UserMode/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-EapHost/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-EventCollector/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Fault-Tolerant-Heap/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-FMS/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Folder Redirection/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Forwarding/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-GroupPolicy/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Help/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-HomeGroup Control Panel/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-HomeGroup Listener Service/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-HomeGroup Provider Service/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-IKE/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-International/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-International-RegionalOptionsControlPanel/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Iphlpsvc/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Kernel-EventTracing/Admin"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Kernel-Power/Thermal-Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Kernel-StoreMgr/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Kernel-WDI/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Kernel-WHEA/Errors"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Kernel-WHEA/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Known Folders API Service"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-LanguagePackSetup/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-MCT/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-MemoryDiagnostics-Results/Debug"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-MUI/Admin"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-MUI/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-NCSI/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-NetworkAccessProtection/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-NetworkAccessProtection/WHC"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-NetworkLocationWizard/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-NetworkProfile/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-NlaSvc/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-NTLM/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-OfflineFiles/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-ParentalControls/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-PeopleNearMe/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-PowerShell/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-PrintService/Admin"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-ReadyBoost/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-ReadyBoostDriver/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Recovery/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-ReliabilityAnalysisComponent/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-RemoteApp and Desktop Connections/Admin"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-RemoteAssistance/Admin"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-RemoteAssistance/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Resource-Exhaustion-Detector/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Resource-Exhaustion-Resolver/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Resource-Leak-Diagnostic/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-RestartManager/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Security-Audit-Configuration-Client/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-TerminalServices-LocalSessionManager/Admin"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-TerminalServices-LocalSessionManager/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-TerminalServices-PnPDevices/Admin"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-TerminalServices-PnPDevices/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-TerminalServices-RDPClient/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-TerminalServices-RemoteConnectionManager/Admin"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-TerminalServices-RemoteConnectionManager/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-TZUtil/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-UAC/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-UAC-FileVirtualization/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-User Profile Service/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-VDRVROOT/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-VHDMP/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-WER-Diag/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-WFP/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Windows Defender/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Windows Defender/WHC"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Windows Firewall With Advanced Security/ConnectionSecurity"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Windows Firewall With Advanced Security/Firewall"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-WindowsBackup/ActionCenter"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-WindowsSystemAssessmentTool/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-WindowsUpdateClient/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Winlogon/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-WinRM/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Winsock-WS2HELP/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-Wired-AutoConfig/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-WLAN-AutoConfig/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-WPD-ClassInstaller/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-WPD-CompositeClassDriver/Operational"')
_RunDos('wevtutil.exe cl "Microsoft-Windows-WPD-MTPClassDriver/Operational"')
_RunDos('wevtutil.exe cl "ODiag"')
_RunDos('wevtutil.exe cl "OSession"')
_RunDos('wevtutil.exe cl "Security"')
_RunDos('wevtutil.exe cl "Setup"')
_RunDos('wevtutil.exe cl "System"')
_RunDos('wevtutil.exe cl "Windows PowerShell"')
|