Solution Definition
The following Windows 7 recipe will help you while imaging (with imagex.exe into a WIM file) the client operating system for deployment. The script can be run from PowerShell or CMD file. I have integrated the following script just after Sysprep.exe has run to make sure all events in the Windows EventViewer have been cleared. Last year during the engineering process of Windows 7 image I forgot the clean all Windows 7 logs. This recipe will clean the system for better troubleshooting down the road.
Requirements
- Make sure you open a shell with Windows 7 elevated privileges
- Create a ps1 or cmd file based on the script below.
Script Option 1 (long one)
@echo off<br />REM -----------------------------------------------------------------------------------------<br />REM Script: clear-windows-7-eventvwr.cmd<br />REM Creation date: 11 March 2010<br />REM Last Modified: 14 March 2010<br />REM Author: Ivan Versluis / http://www.networknet.nl<br />REM Email: [email protected]<br />REM Description: This command shell script will clear<br />REM all Windows Event Logs on a Windows 7 system from command line.<br />REM -----------------------------------------------------------------------------------------<br />wevtutil.exe cl "Analytic"<br />wevtutil.exe cl "Application"<br />wevtutil.exe cl "DirectShowFilterGraph"<br />wevtutil.exe cl "DirectShowPluginControl"<br />wevtutil.exe cl "EndpointMapper"<br />wevtutil.exe cl "ForwardedEvents"<br />wevtutil.exe cl "HardwareEvents"<br />wevtutil.exe cl "Internet Explorer"<br />wevtutil.exe cl "Key Management Service"<br />wevtutil.exe cl "MF_MediaFoundationDeviceProxy"<br />wevtutil.exe cl "Media Center"<br />wevtutil.exe cl "MediaFoundationDeviceProxy"<br />wevtutil.exe cl "MediaFoundationPerformance"<br />wevtutil.exe cl "MediaFoundationPipeline"<br />wevtutil.exe cl "MediaFoundationPlatform"<br />wevtutil.exe cl "Microsoft-IE/Diagnostic"<br />wevtutil.exe cl "Microsoft-IEFRAME/Diagnostic"<br />wevtutil.exe cl "Microsoft-PerfTrack-IEFRAME/Diagnostic"<br />wevtutil.exe cl "Microsoft-PerfTrack-MSHTML/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-ADSI/Debug"<br />wevtutil.exe cl "Microsoft-Windows-API-Tracing/Operational"<br />wevtutil.exe cl "Microsoft-Windows-ATAPort/General"<br />wevtutil.exe cl "Microsoft-Windows-ATAPort/SATA-LPM"<br />wevtutil.exe cl "Microsoft-Windows-ActionQueue/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-AltTab/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-AppID/Operational"<br />wevtutil.exe cl "Microsoft-Windows-AppLocker/EXE and DLL"<br />wevtutil.exe cl "Microsoft-Windows-AppLocker/MSI and Script"<br />wevtutil.exe cl "Microsoft-Windows-Application-Experience/Problem-Steps-Recorder"<br />wevtutil.exe cl "Microsoft-Windows-Application-Experience/Program-Compatibility-Assistant"<br />wevtutil.exe cl "Microsoft-Windows-Application-Experience/Program-Compatibility-Troubleshooter"<br />wevtutil.exe cl "Microsoft-Windows-Application-Experience/Program-Inventory"<br />wevtutil.exe cl "Microsoft-Windows-Application-Experience/Program-Inventory/Debug"<br />wevtutil.exe cl "Microsoft-Windows-Application-Experience/Program-Telemetry"<br />wevtutil.exe cl "Microsoft-Windows-Audio/CaptureMonitor"<br />wevtutil.exe cl "Microsoft-Windows-Audio/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Audio/Performance"<br />wevtutil.exe cl "Microsoft-Windows-Audit/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-Authentication User Interface/Operational"<br />wevtutil.exe cl "Microsoft-Windows-AxInstallService/Log"<br />wevtutil.exe cl "Microsoft-Windows-Backup"<br />wevtutil.exe cl "Microsoft-Windows-Biometrics/Operational"<br />wevtutil.exe cl "Microsoft-Windows-BitLocker-DrivePreparationTool/Admin"<br />wevtutil.exe cl "Microsoft-Windows-BitLocker-DrivePreparationTool/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Bits-Client/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-Bits-Client/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Bluetooth-MTPEnum/Operational"<br />wevtutil.exe cl "Microsoft-Windows-BranchCache/Operational"<br />wevtutil.exe cl "Microsoft-Windows-BranchCacheClientEventProvider/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-BranchCacheEventProvider/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-BranchCacheSMB/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-BranchCacheSMB/Operational"<br />wevtutil.exe cl "Microsoft-Windows-CAPI2/Operational"<br />wevtutil.exe cl "Microsoft-Windows-CDROM/Operational"<br />wevtutil.exe cl "Microsoft-Windows-COM/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-COMRuntime/Tracing"<br />wevtutil.exe cl "Microsoft-Windows-Calculator/Debug"<br />wevtutil.exe cl "Microsoft-Windows-Calculator/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-CertPoleEng/Operational"<br />wevtutil.exe cl "Microsoft-Windows-CertificateServicesClient-CredentialRoaming/Operational"<br />wevtutil.exe cl "Microsoft-Windows-ClearTypeTextTuner/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-CmiSetup/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-CodeIntegrity/Operational"<br />wevtutil.exe cl "Microsoft-Windows-CodeIntegrity/Verbose"<br />wevtutil.exe cl "Microsoft-Windows-ComDlg32/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-ComDlg32/Debug"<br />wevtutil.exe cl "Microsoft-Windows-CorruptedFileRecovery-Client/Operational"<br />wevtutil.exe cl "Microsoft-Windows-CorruptedFileRecovery-Server/Operational"<br />wevtutil.exe cl "Microsoft-Windows-CredUI/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Crypto-RNG/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-DCLocator/Debug"<br />wevtutil.exe cl "Microsoft-Windows-DNS-Client/Operational"<br />wevtutil.exe cl "Microsoft-Windows-DUI/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-DUSER/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-DXP/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-DateTimeControlPanel/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-DateTimeControlPanel/Debug"<br />wevtutil.exe cl "Microsoft-Windows-DateTimeControlPanel/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Deplorch/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-DeviceSync/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-DeviceSync/Operational"<br />wevtutil.exe cl "Microsoft-Windows-DeviceUx/Informational"<br />wevtutil.exe cl "Microsoft-Windows-DeviceUx/Performance"<br />wevtutil.exe cl "Microsoft-Windows-Dhcp-Client/Admin"<br />wevtutil.exe cl "Microsoft-Windows-Dhcp-Client/Operational"<br />wevtutil.exe cl "Microsoft-Windows-DhcpNap/Admin"<br />wevtutil.exe cl "Microsoft-Windows-DhcpNap/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Dhcpv6-Client/Admin"<br />wevtutil.exe cl "Microsoft-Windows-Dhcpv6-Client/Operational"<br />wevtutil.exe cl "Microsoft-Windows-DiagCpl/Debug"<br />wevtutil.exe cl "Microsoft-Windows-Diagnosis-DPS/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-Diagnosis-DPS/Debug"<br />wevtutil.exe cl "Microsoft-Windows-Diagnosis-DPS/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Diagnosis-MSDE/Debug"<br />wevtutil.exe cl "Microsoft-Windows-Diagnosis-PCW/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-Diagnosis-PCW/Debug"<br />wevtutil.exe cl "Microsoft-Windows-Diagnosis-PCW/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Diagnosis-PLA/Debug"<br />wevtutil.exe cl "Microsoft-Windows-Diagnosis-PLA/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Diagnosis-Scheduled/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Diagnosis-Scripted/Admin"<br />wevtutil.exe cl "Microsoft-Windows-Diagnosis-Scripted/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-Diagnosis-Scripted/Debug"<br />wevtutil.exe cl "Microsoft-Windows-Diagnosis-Scripted/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Diagnosis-ScriptedDiagnosticsProvider/Debug"<br />wevtutil.exe cl "Microsoft-Windows-Diagnosis-ScriptedDiagnosticsProvider/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Diagnosis-TaskManager/Debug"<br />wevtutil.exe cl "Microsoft-Windows-Diagnosis-WDC/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-Diagnosis-WDI/Debug"<br />wevtutil.exe cl "Microsoft-Windows-Diagnostics-Networking/Debug"<br />wevtutil.exe cl "Microsoft-Windows-Diagnostics-Networking/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Diagnostics-PerfTrack-Counters/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Diagnostics-PerfTrack/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Diagnostics-Performance/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Diagnostics-Performance/Diagnostic/Loopback"<br />wevtutil.exe cl "Microsoft-Windows-Diagnostics-Performance/Operational"<br />wevtutil.exe cl "Microsoft-Windows-DirectShow-KernelSupport/Performance"<br />wevtutil.exe cl "Microsoft-Windows-DirectSound/Debug"<br />wevtutil.exe cl "Microsoft-Windows-DirectWrite-FontCache/Tracing"<br />wevtutil.exe cl "Microsoft-Windows-Disk/Operational"<br />wevtutil.exe cl "Microsoft-Windows-DiskDiagnostic/Operational"<br />wevtutil.exe cl "Microsoft-Windows-DiskDiagnosticDataCollector/Operational"<br />wevtutil.exe cl "Microsoft-Windows-DiskDiagnosticResolver/Operational"<br />wevtutil.exe cl "Microsoft-Windows-DisplayColorCalibration/Debug"<br />wevtutil.exe cl "Microsoft-Windows-DisplayColorCalibration/Operational"<br />wevtutil.exe cl "Microsoft-Windows-DisplaySwitch/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Documents/Performance"<br />wevtutil.exe cl "Microsoft-Windows-DriverFrameworks-UserMode/Operational"<br />wevtutil.exe cl "Microsoft-Windows-DxgKrnl/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-DxgKrnl/Performance"<br />wevtutil.exe cl "Microsoft-Windows-DxpTaskRingtone/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-DxpTaskSyncProvider/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-EFS/Debug"<br />wevtutil.exe cl "Microsoft-Windows-EapHost/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-EapHost/Debug"<br />wevtutil.exe cl "Microsoft-Windows-EapHost/Operational"<br />wevtutil.exe cl "Microsoft-Windows-EaseOfAccess/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-EventCollector/Debug"<br />wevtutil.exe cl "Microsoft-Windows-EventCollector/Operational"<br />wevtutil.exe cl "Microsoft-Windows-EventLog-WMIProvider/Debug"<br />wevtutil.exe cl "Microsoft-Windows-EventLog/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-EventLog/Debug"<br />wevtutil.exe cl "Microsoft-Windows-FMS/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-FMS/Debug"<br />wevtutil.exe cl "Microsoft-Windows-FMS/Operational"<br />wevtutil.exe cl "Microsoft-Windows-FailoverClustering-Client/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Fault-Tolerant-Heap/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Feedback-Service-TriggerProvider"<br />wevtutil.exe cl "Microsoft-Windows-FileInfoMinifilter/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Firewall-CPL/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Folder Redirection/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Forwarding/Debug"<br />wevtutil.exe cl "Microsoft-Windows-Forwarding/Operational"<br />wevtutil.exe cl "Microsoft-Windows-GettingStarted/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-GroupPolicy/Operational"<br />wevtutil.exe cl "Microsoft-Windows-HAL/Debug"<br />wevtutil.exe cl "Microsoft-Windows-HealthCenter/Debug"<br />wevtutil.exe cl "Microsoft-Windows-HealthCenter/Performance"<br />wevtutil.exe cl "Microsoft-Windows-HealthCenterCPL/Performance"<br />wevtutil.exe cl "Microsoft-Windows-Help/Operational"<br />wevtutil.exe cl "Microsoft-Windows-HomeGroup Control Panel Performance/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-HomeGroup Control Panel/Operational"<br />wevtutil.exe cl "Microsoft-Windows-HomeGroup Listener Service/Operational"<br />wevtutil.exe cl "Microsoft-Windows-HomeGroup Provider Service Performance/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-HomeGroup Provider Service/Operational"<br />wevtutil.exe cl "Microsoft-Windows-HomeGroup-ListenerService"<br />wevtutil.exe cl "Microsoft-Windows-HotStart/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-HttpService/Trace"<br />wevtutil.exe cl "Microsoft-Windows-IKE/Operational"<br />wevtutil.exe cl "Microsoft-Windows-IKEDBG/Debug"<br />wevtutil.exe cl "Microsoft-Windows-IPBusEnum/Tracing"<br />wevtutil.exe cl "Microsoft-Windows-IPSEC-SRV/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-International-RegionalOptionsControlPanel/Operational"<br />wevtutil.exe cl "Microsoft-Windows-International/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Iphlpsvc/Debug"<br />wevtutil.exe cl "Microsoft-Windows-Iphlpsvc/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Iphlpsvc/Trace"<br />wevtutil.exe cl "Microsoft-Windows-Kernel-Acpi/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Kernel-Boot/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-Kernel-BootDiagnostics/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Kernel-Disk/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-Kernel-EventTracing/Admin"<br />wevtutil.exe cl "Microsoft-Windows-Kernel-EventTracing/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-Kernel-File/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-Kernel-Memory/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-Kernel-Network/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-Kernel-PnP/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Kernel-Power/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Kernel-Power/Thermal-Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Kernel-Power/Thermal-Operational"<br />wevtutil.exe cl "Microsoft-Windows-Kernel-Prefetch/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Kernel-Process/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-Kernel-Processor-Power/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Kernel-Registry/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-Kernel-StoreMgr/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-Kernel-StoreMgr/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Kernel-WDI/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-Kernel-WDI/Debug"<br />wevtutil.exe cl "Microsoft-Windows-Kernel-WDI/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Kernel-WHEA/Errors"<br />wevtutil.exe cl "Microsoft-Windows-Kernel-WHEA/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Known Folders API Service"<br />wevtutil.exe cl "Microsoft-Windows-L2NA/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-LDAP-Client/Debug"<br />wevtutil.exe cl "Microsoft-Windows-LUA-ConsentUI/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-LanguagePackSetup/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-LanguagePackSetup/Debug"<br />wevtutil.exe cl "Microsoft-Windows-LanguagePackSetup/Operational"<br />wevtutil.exe cl "Microsoft-Windows-MCT/Operational"<br />wevtutil.exe cl "Microsoft-Windows-MPS-CLNT/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-MPS-DRV/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-MPS-SRV/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-MSPaint/Admin"<br />wevtutil.exe cl "Microsoft-Windows-MSPaint/Debug"<br />wevtutil.exe cl "Microsoft-Windows-MSPaint/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-MUI/Admin"<br />wevtutil.exe cl "Microsoft-Windows-MUI/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-MUI/Debug"<br />wevtutil.exe cl "Microsoft-Windows-MUI/Operational"<br />wevtutil.exe cl "Microsoft-Windows-MediaFoundation-MFReadWrite/SinkWriter"<br />wevtutil.exe cl "Microsoft-Windows-MediaFoundation-MFReadWrite/SourceReader"<br />wevtutil.exe cl "Microsoft-Windows-MediaFoundation-MFReadWrite/Transform"<br />wevtutil.exe cl "Microsoft-Windows-MediaFoundation-PlayAPI/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-MemoryDiagnostics-Results/Debug"<br />wevtutil.exe cl "Microsoft-Windows-MobilityCenter/Performance"<br />wevtutil.exe cl "Microsoft-Windows-NCSI/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-NCSI/Operational"<br />wevtutil.exe cl "Microsoft-Windows-NDF-HelperClassDiscovery/Debug"<br />wevtutil.exe cl "Microsoft-Windows-NDIS-PacketCapture/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-NDIS/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-NDIS/Operational"<br />wevtutil.exe cl "Microsoft-Windows-NTLM/Operational"<br />wevtutil.exe cl "Microsoft-Windows-NWiFi/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Narrator/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-NetShell/Performance"<br />wevtutil.exe cl "Microsoft-Windows-Network-and-Sharing-Center/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-NetworkAccessProtection/Operational"<br />wevtutil.exe cl "Microsoft-Windows-NetworkAccessProtection/WHC"<br />wevtutil.exe cl "Microsoft-Windows-NetworkLocationWizard/Operational"<br />wevtutil.exe cl "Microsoft-Windows-NetworkProfile/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-NetworkProfile/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Networking-Correlation/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-NlaSvc/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-NlaSvc/Operational"<br />wevtutil.exe cl "Microsoft-Windows-OLEACC/Debug"<br />wevtutil.exe cl "Microsoft-Windows-OLEACC/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-OOBE-Machine/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-OfflineFiles/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-OfflineFiles/Debug"<br />wevtutil.exe cl "Microsoft-Windows-OfflineFiles/Operational"<br />wevtutil.exe cl "Microsoft-Windows-OfflineFiles/SyncLog"<br />wevtutil.exe cl "Microsoft-Windows-OneX/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-OobeLdr/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-PCI/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-ParentalControls/Operational"<br />wevtutil.exe cl "Microsoft-Windows-PeerToPeerDrtEventProvider/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-PeopleNearMe/Operational"<br />wevtutil.exe cl "Microsoft-Windows-PortableDeviceStatusProvider/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-PortableDeviceSyncProvider/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-PowerCfg/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-PowerCpl/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-PowerEfficiencyDiagnostics/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-PowerShell/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-PowerShell/Operational"<br />wevtutil.exe cl "Microsoft-Windows-PrimaryNetworkIcon/Performance"<br />wevtutil.exe cl "Microsoft-Windows-PrintService/Admin"<br />wevtutil.exe cl "Microsoft-Windows-PrintService/Debug"<br />wevtutil.exe cl "Microsoft-Windows-PrintService/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Program-Compatibility-Assistant/Debug"<br />wevtutil.exe cl "Microsoft-Windows-QoS-Pacer/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-QoS-qWAVE/Debug"<br />wevtutil.exe cl "Microsoft-Windows-RPC/Debug"<br />wevtutil.exe cl "Microsoft-Windows-RPC/EEInfo"<br />wevtutil.exe cl "Microsoft-Windows-ReadyBoost/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-ReadyBoost/Operational"<br />wevtutil.exe cl "Microsoft-Windows-ReadyBoostDriver/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-ReadyBoostDriver/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Recovery/Operational"<br />wevtutil.exe cl "Microsoft-Windows-ReliabilityAnalysisComponent/Operational"<br />wevtutil.exe cl "Microsoft-Windows-RemoteApp and Desktop Connections/Admin"<br />wevtutil.exe cl "Microsoft-Windows-RemoteAssistance/Admin"<br />wevtutil.exe cl "Microsoft-Windows-RemoteAssistance/Operational"<br />wevtutil.exe cl "Microsoft-Windows-RemoteAssistance/Tracing"<br />wevtutil.exe cl "Microsoft-Windows-Remotefs-UTProvider/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Resource-Exhaustion-Detector/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Resource-Exhaustion-Resolver/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Resource-Leak-Diagnostic/Operational"<br />wevtutil.exe cl "Microsoft-Windows-ResourcePublication/Tracing"<br />wevtutil.exe cl "Microsoft-Windows-RestartManager/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Search-Core/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Search-ProtocolHandlers/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Security-Audit-Configuration-Client/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Security-Audit-Configuration-Client/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Security-IdentityListener/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Security-SPP/Perf"<br />wevtutil.exe cl "Microsoft-Windows-Sens/Debug"<br />wevtutil.exe cl "Microsoft-Windows-ServiceReportingApi/Debug"<br />wevtutil.exe cl "Microsoft-Windows-Services-Svchost/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Services/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Setup/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-SetupCl/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-SetupQueue/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-SetupUGC/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-ShareMedia-ControlPanel/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Shell-AuthUI-BootAnim/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Shell-AuthUI-Common/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Shell-AuthUI-CredUI/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Shell-AuthUI-Logon/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Shell-AuthUI-PasswordProvider/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Shell-AuthUI-Shutdown/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Shell-Core/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Shell-DefaultPrograms/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Shell-Shwebsvc"<br />wevtutil.exe cl "Microsoft-Windows-Shell-ZipFolder/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Shsvcs/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Sidebar/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Speech-UserExperience/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-StickyNotes/Admin"<br />wevtutil.exe cl "Microsoft-Windows-StickyNotes/Debug"<br />wevtutil.exe cl "Microsoft-Windows-StickyNotes/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-StorDiag/Operational"<br />wevtutil.exe cl "Microsoft-Windows-StorPort/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Subsys-Csr/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Subsys-SMSS/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Superfetch/Main"<br />wevtutil.exe cl "Microsoft-Windows-Superfetch/StoreLog"<br />wevtutil.exe cl "Microsoft-Windows-Sysprep/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-SystemHealthAgent/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-TCPIP/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-TSF-msctf/Debug"<br />wevtutil.exe cl "Microsoft-Windows-TSF-msctf/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-TSF-msutb/Debug"<br />wevtutil.exe cl "Microsoft-Windows-TSF-msutb/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-TZUtil/Operational"<br />wevtutil.exe cl "Microsoft-Windows-TaskScheduler/Debug"<br />wevtutil.exe cl "Microsoft-Windows-TaskScheduler/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-TaskScheduler/Operational"<br />wevtutil.exe cl "Microsoft-Windows-TaskbarCPL/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-TerminalServices-LocalSessionManager/Admin"<br />wevtutil.exe cl "Microsoft-Windows-TerminalServices-LocalSessionManager/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-TerminalServices-LocalSessionManager/Debug"<br />wevtutil.exe cl "Microsoft-Windows-TerminalServices-LocalSessionManager/Operational"<br />wevtutil.exe cl "Microsoft-Windows-TerminalServices-MediaRedirection/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-TerminalServices-PnPDevices/Admin"<br />wevtutil.exe cl "Microsoft-Windows-TerminalServices-PnPDevices/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-TerminalServices-PnPDevices/Debug"<br />wevtutil.exe cl "Microsoft-Windows-TerminalServices-PnPDevices/Operational"<br />wevtutil.exe cl "Microsoft-Windows-TerminalServices-RDPClient/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-TerminalServices-RDPClient/Debug"<br />wevtutil.exe cl "Microsoft-Windows-TerminalServices-RDPClient/Operational"<br />wevtutil.exe cl "Microsoft-Windows-TerminalServices-RdpSoundDriver/Capture"<br />wevtutil.exe cl "Microsoft-Windows-TerminalServices-RdpSoundDriver/Playback"<br />wevtutil.exe cl "Microsoft-Windows-TerminalServices-RemoteConnectionManager/Admin"<br />wevtutil.exe cl "Microsoft-Windows-TerminalServices-RemoteConnectionManager/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-TerminalServices-RemoteConnectionManager/Debug"<br />wevtutil.exe cl "Microsoft-Windows-TerminalServices-RemoteConnectionManager/Operational"<br />wevtutil.exe cl "Microsoft-Windows-ThemeCPL/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-ThemeUI/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-TunnelDriver"<br />wevtutil.exe cl "Microsoft-Windows-UAC-FileVirtualization/Operational"<br />wevtutil.exe cl "Microsoft-Windows-UAC/Operational"<br />wevtutil.exe cl "Microsoft-Windows-UIAnimation/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-UIAutomationCore/Debug"<br />wevtutil.exe cl "Microsoft-Windows-UIAutomationCore/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-UIAutomationCore/Perf"<br />wevtutil.exe cl "Microsoft-Windows-UIRibbon/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-USB-USBHUB/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-USB-USBPORT/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-User Control Panel Performance/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-User Profile Service/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-User Profile Service/Operational"<br />wevtutil.exe cl "Microsoft-Windows-User-Loader/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-UserModePowerService/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-UserPnp/DeviceMetadata/Debug"<br />wevtutil.exe cl "Microsoft-Windows-UserPnp/DeviceNotifications"<br />wevtutil.exe cl "Microsoft-Windows-UserPnp/Performance"<br />wevtutil.exe cl "Microsoft-Windows-UserPnp/SchedulerOperations"<br />wevtutil.exe cl "Microsoft-Windows-UxTheme/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-VAN/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-VDRVROOT/Operational"<br />wevtutil.exe cl "Microsoft-Windows-VHDMP/Operational"<br />wevtutil.exe cl "Microsoft-Windows-VWiFi/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-VolumeControl/Performance"<br />wevtutil.exe cl "Microsoft-Windows-VolumeSnapshot-Driver/Operational"<br />wevtutil.exe cl "Microsoft-Windows-WABSyncProvider/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-WCN-Config-Registrar/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-WER-Diag/Operational"<br />wevtutil.exe cl "Microsoft-Windows-WFP/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-WFP/Operational"<br />wevtutil.exe cl "Microsoft-Windows-WLAN-AutoConfig/Operational"<br />wevtutil.exe cl "Microsoft-Windows-WLAN-Autoconfig/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-WLANConnectionFlow/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-WMI-Activity/Trace"<br />wevtutil.exe cl "Microsoft-Windows-WMPDMCCore/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-WMPDMCUI/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-WMPNSS-PublicAPI/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-WMPNSS-Service/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-WMPNSSUI/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-WPD-ClassInstaller/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-WPD-ClassInstaller/Operational"<br />wevtutil.exe cl "Microsoft-Windows-WPD-CompositeClassDriver/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-WPD-CompositeClassDriver/Operational"<br />wevtutil.exe cl "Microsoft-Windows-WPD-MTPClassDriver/Operational"<br />wevtutil.exe cl "Microsoft-Windows-WSC-SRV/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-WUSA/Debug"<br />wevtutil.exe cl "Microsoft-Windows-WWAN-MM-Events/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-WWAN-NDISUIO-EVENTS/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-WWAN-SVC-Events/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-WWAN-UI-Events/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-WebIO-NDF/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-WebIO/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-WebServices/Tracing"<br />wevtutil.exe cl "Microsoft-Windows-Win32k/Concurrency"<br />wevtutil.exe cl "Microsoft-Windows-Win32k/Power"<br />wevtutil.exe cl "Microsoft-Windows-Win32k/Render"<br />wevtutil.exe cl "Microsoft-Windows-Win32k/Tracing"<br />wevtutil.exe cl "Microsoft-Windows-Win32k/UIPI"<br />wevtutil.exe cl "Microsoft-Windows-WinHTTP-NDF/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-WinHttp/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-WinINet/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-WinRM/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-WinRM/Debug"<br />wevtutil.exe cl "Microsoft-Windows-WinRM/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Windeploy/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-Windows Defender/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Windows Defender/WHC"<br />wevtutil.exe cl "Microsoft-Windows-Windows Firewall With Advanced Security/ConnectionSecurity"<br />wevtutil.exe cl "Microsoft-Windows-Windows Firewall With Advanced Security/ConnectionSecurityVerbose"<br />wevtutil.exe cl "Microsoft-Windows-Windows Firewall With Advanced Security/Firewall"<br />wevtutil.exe cl "Microsoft-Windows-Windows Firewall With Advanced Security/FirewallVerbose"<br />wevtutil.exe cl "Microsoft-Windows-WindowsBackup/ActionCenter"<br />wevtutil.exe cl "Microsoft-Windows-WindowsColorSystem/Debug"<br />wevtutil.exe cl "Microsoft-Windows-WindowsColorSystem/Operational"<br />wevtutil.exe cl "Microsoft-Windows-WindowsSystemAssessmentTool/Operational"<br />wevtutil.exe cl "Microsoft-Windows-WindowsSystemAssessmentTool/Tracing"<br />wevtutil.exe cl "Microsoft-Windows-WindowsUpdateClient/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Wininit/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Winlogon/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Winlogon/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Winsock-AFD/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Winsock-WS2HELP/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Winsrv/Analytic"<br />wevtutil.exe cl "Microsoft-Windows-Wired-AutoConfig/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-Wired-AutoConfig/Operational"<br />wevtutil.exe cl "Microsoft-Windows-Wordpad/Admin"<br />wevtutil.exe cl "Microsoft-Windows-Wordpad/Debug"<br />wevtutil.exe cl "Microsoft-Windows-Wordpad/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-mobsync/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-ntshrui"<br />wevtutil.exe cl "Microsoft-Windows-osk/Diagnostic"<br />wevtutil.exe cl "Microsoft-Windows-stobject/Diagnostic"<br />wevtutil.exe cl "OAlerts"<br />wevtutil.exe cl "Security"<br />wevtutil.exe cl "Setup"<br />wevtutil.exe cl "System"<br />wevtutil.exe cl "TabletPC_InputPanel_Channel"<br />wevtutil.exe cl "WINDOWS_MP4SDECD_CHANNEL"<br />wevtutil.exe cl "WMPSetup"<br />wevtutil.exe cl "WMPSyncEngine"<br />wevtutil.exe cl "Windows PowerShell"<br />wevtutil.exe cl "muxencode"<br />echo --------------------------------------------------<br />echo Script cleared Windows 7 event logs.<br />echo --------------------------------------------------
Script Option 2 (short one)
Wevtutil el > logs.txt For /f "delims=;" %%i in (logs.txt) do wevtutil cl "%%i"
Special thanks to Garry who shared the short version of the recipe.
Garry
Check out this Post,
http://blogs.technet.com/b/askds/archive/2011/02/25/friday-mail-sack-xxxxxxxxxxxx.aspx
Wevtutil el > %temp%\eventlistmsft.txt
For /f “delims=;” %%i in (%temp%\eventlistmsft.txt) do wevtutil cl “%%i”
Ivan Versluis
Thanks Garry! I was looking for that before. Yes that one is much easier than the script I created. Both steps will result in having empty eventlogs. I will add the script as solution 2 and keep the actions lean.
Ivan Versluis
After emailing with Garry I tested script option 2 which works fine too. Both scripts can be used but option 1 allows you to create your custom script to tweak clearing if you want.
I’ve another idea how to do this in powershell.
Jeremy
Thanks to both of you. I used the link that Gary posted and it worked like a charm. I prep images for Dell Image Direct, for my company to use, and one of the things that has to be done when cleaning up the OS is clearing the Event Viewer log files. Before finding the script, I would do this manually and it would take 15 to 20 minutes. This script did it in about 10 seconds.
wap tek
[Start] [Run] type
for /F “tokens=*” %a in (‘wevtutil.exe el’) DO ECHO wevtutil.exe cl “%a”
type up a bat/cmd file & name it killogs.cmd & use this line in it
for /F “tokens=*” %%a in (‘wevtutil.exe el’) DO ECHO wevtutil.exe cl “%%a”