I use this Windows 7 script when preparing a client operating system image with imagex.exe and a WIM file for deployment. I integrated it immediately after Sysprep.exe to clear the Windows event logs. Last year, while building a Windows 7 image, I forgot to clear the logs. Starting with clean logs makes later troubleshooting easier.
Requirements Open a command shell with elevated privileges on Windows 7. Create a cmd file using the script below. Option 1: Clear the listed event logs Code 474 lines Copy 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
@echo off
REM -----------------------------------------------------------------------------------------
REM Script: clear-windows-7-eventvwr.cmd
REM Creation date: 11 March 2010
REM Last Modified: 14 March 2010
REM Author: Ivan Versluis / http://www.networknet.nl
REM Email: [email protected]
REM Description: This command shell script will clear
REM all Windows Event Logs on a Windows 7 system from command line.
REM -----------------------------------------------------------------------------------------
wevtutil.exe cl "Analytic"
wevtutil.exe cl "Application"
wevtutil.exe cl "DirectShowFilterGraph"
wevtutil.exe cl "DirectShowPluginControl"
wevtutil.exe cl "EndpointMapper"
wevtutil.exe cl "ForwardedEvents"
wevtutil.exe cl "HardwareEvents"
wevtutil.exe cl "Internet Explorer"
wevtutil.exe cl "Key Management Service"
wevtutil.exe cl "MF_MediaFoundationDeviceProxy"
wevtutil.exe cl "Media Center"
wevtutil.exe cl "MediaFoundationDeviceProxy"
wevtutil.exe cl "MediaFoundationPerformance"
wevtutil.exe cl "MediaFoundationPipeline"
wevtutil.exe cl "MediaFoundationPlatform"
wevtutil.exe cl "Microsoft-IE/Diagnostic"
wevtutil.exe cl "Microsoft-IEFRAME/Diagnostic"
wevtutil.exe cl "Microsoft-PerfTrack-IEFRAME/Diagnostic"
wevtutil.exe cl "Microsoft-PerfTrack-MSHTML/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-ADSI/Debug"
wevtutil.exe cl "Microsoft-Windows-API-Tracing/Operational"
wevtutil.exe cl "Microsoft-Windows-ATAPort/General"
wevtutil.exe cl "Microsoft-Windows-ATAPort/SATA-LPM"
wevtutil.exe cl "Microsoft-Windows-ActionQueue/Analytic"
wevtutil.exe cl "Microsoft-Windows-AltTab/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-AppID/Operational"
wevtutil.exe cl "Microsoft-Windows-AppLocker/EXE and DLL"
wevtutil.exe cl "Microsoft-Windows-AppLocker/MSI and Script"
wevtutil.exe cl "Microsoft-Windows-Application-Experience/Problem-Steps-Recorder"
wevtutil.exe cl "Microsoft-Windows-Application-Experience/Program-Compatibility-Assistant"
wevtutil.exe cl "Microsoft-Windows-Application-Experience/Program-Compatibility-Troubleshooter"
wevtutil.exe cl "Microsoft-Windows-Application-Experience/Program-Inventory"
wevtutil.exe cl "Microsoft-Windows-Application-Experience/Program-Inventory/Debug"
wevtutil.exe cl "Microsoft-Windows-Application-Experience/Program-Telemetry"
wevtutil.exe cl "Microsoft-Windows-Audio/CaptureMonitor"
wevtutil.exe cl "Microsoft-Windows-Audio/Operational"
wevtutil.exe cl "Microsoft-Windows-Audio/Performance"
wevtutil.exe cl "Microsoft-Windows-Audit/Analytic"
wevtutil.exe cl "Microsoft-Windows-Authentication User Interface/Operational"
wevtutil.exe cl "Microsoft-Windows-AxInstallService/Log"
wevtutil.exe cl "Microsoft-Windows-Backup"
wevtutil.exe cl "Microsoft-Windows-Biometrics/Operational"
wevtutil.exe cl "Microsoft-Windows-BitLocker-DrivePreparationTool/Admin"
wevtutil.exe cl "Microsoft-Windows-BitLocker-DrivePreparationTool/Operational"
wevtutil.exe cl "Microsoft-Windows-Bits-Client/Analytic"
wevtutil.exe cl "Microsoft-Windows-Bits-Client/Operational"
wevtutil.exe cl "Microsoft-Windows-Bluetooth-MTPEnum/Operational"
wevtutil.exe cl "Microsoft-Windows-BranchCache/Operational"
wevtutil.exe cl "Microsoft-Windows-BranchCacheClientEventProvider/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-BranchCacheEventProvider/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-BranchCacheSMB/Analytic"
wevtutil.exe cl "Microsoft-Windows-BranchCacheSMB/Operational"
wevtutil.exe cl "Microsoft-Windows-CAPI2/Operational"
wevtutil.exe cl "Microsoft-Windows-CDROM/Operational"
wevtutil.exe cl "Microsoft-Windows-COM/Analytic"
wevtutil.exe cl "Microsoft-Windows-COMRuntime/Tracing"
wevtutil.exe cl "Microsoft-Windows-Calculator/Debug"
wevtutil.exe cl "Microsoft-Windows-Calculator/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-CertPoleEng/Operational"
wevtutil.exe cl "Microsoft-Windows-CertificateServicesClient-CredentialRoaming/Operational"
wevtutil.exe cl "Microsoft-Windows-ClearTypeTextTuner/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-CmiSetup/Analytic"
wevtutil.exe cl "Microsoft-Windows-CodeIntegrity/Operational"
wevtutil.exe cl "Microsoft-Windows-CodeIntegrity/Verbose"
wevtutil.exe cl "Microsoft-Windows-ComDlg32/Analytic"
wevtutil.exe cl "Microsoft-Windows-ComDlg32/Debug"
wevtutil.exe cl "Microsoft-Windows-CorruptedFileRecovery-Client/Operational"
wevtutil.exe cl "Microsoft-Windows-CorruptedFileRecovery-Server/Operational"
wevtutil.exe cl "Microsoft-Windows-CredUI/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Crypto-RNG/Analytic"
wevtutil.exe cl "Microsoft-Windows-DCLocator/Debug"
wevtutil.exe cl "Microsoft-Windows-DNS-Client/Operational"
wevtutil.exe cl "Microsoft-Windows-DUI/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-DUSER/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-DXP/Analytic"
wevtutil.exe cl "Microsoft-Windows-DateTimeControlPanel/Analytic"
wevtutil.exe cl "Microsoft-Windows-DateTimeControlPanel/Debug"
wevtutil.exe cl "Microsoft-Windows-DateTimeControlPanel/Operational"
wevtutil.exe cl "Microsoft-Windows-Deplorch/Analytic"
wevtutil.exe cl "Microsoft-Windows-DeviceSync/Analytic"
wevtutil.exe cl "Microsoft-Windows-DeviceSync/Operational"
wevtutil.exe cl "Microsoft-Windows-DeviceUx/Informational"
wevtutil.exe cl "Microsoft-Windows-DeviceUx/Performance"
wevtutil.exe cl "Microsoft-Windows-Dhcp-Client/Admin"
wevtutil.exe cl "Microsoft-Windows-Dhcp-Client/Operational"
wevtutil.exe cl "Microsoft-Windows-DhcpNap/Admin"
wevtutil.exe cl "Microsoft-Windows-DhcpNap/Operational"
wevtutil.exe cl "Microsoft-Windows-Dhcpv6-Client/Admin"
wevtutil.exe cl "Microsoft-Windows-Dhcpv6-Client/Operational"
wevtutil.exe cl "Microsoft-Windows-DiagCpl/Debug"
wevtutil.exe cl "Microsoft-Windows-Diagnosis-DPS/Analytic"
wevtutil.exe cl "Microsoft-Windows-Diagnosis-DPS/Debug"
wevtutil.exe cl "Microsoft-Windows-Diagnosis-DPS/Operational"
wevtutil.exe cl "Microsoft-Windows-Diagnosis-MSDE/Debug"
wevtutil.exe cl "Microsoft-Windows-Diagnosis-PCW/Analytic"
wevtutil.exe cl "Microsoft-Windows-Diagnosis-PCW/Debug"
wevtutil.exe cl "Microsoft-Windows-Diagnosis-PCW/Operational"
wevtutil.exe cl "Microsoft-Windows-Diagnosis-PLA/Debug"
wevtutil.exe cl "Microsoft-Windows-Diagnosis-PLA/Operational"
wevtutil.exe cl "Microsoft-Windows-Diagnosis-Scheduled/Operational"
wevtutil.exe cl "Microsoft-Windows-Diagnosis-Scripted/Admin"
wevtutil.exe cl "Microsoft-Windows-Diagnosis-Scripted/Analytic"
wevtutil.exe cl "Microsoft-Windows-Diagnosis-Scripted/Debug"
wevtutil.exe cl "Microsoft-Windows-Diagnosis-Scripted/Operational"
wevtutil.exe cl "Microsoft-Windows-Diagnosis-ScriptedDiagnosticsProvider/Debug"
wevtutil.exe cl "Microsoft-Windows-Diagnosis-ScriptedDiagnosticsProvider/Operational"
wevtutil.exe cl "Microsoft-Windows-Diagnosis-TaskManager/Debug"
wevtutil.exe cl "Microsoft-Windows-Diagnosis-WDC/Analytic"
wevtutil.exe cl "Microsoft-Windows-Diagnosis-WDI/Debug"
wevtutil.exe cl "Microsoft-Windows-Diagnostics-Networking/Debug"
wevtutil.exe cl "Microsoft-Windows-Diagnostics-Networking/Operational"
wevtutil.exe cl "Microsoft-Windows-Diagnostics-PerfTrack-Counters/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Diagnostics-PerfTrack/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Diagnostics-Performance/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Diagnostics-Performance/Diagnostic/Loopback"
wevtutil.exe cl "Microsoft-Windows-Diagnostics-Performance/Operational"
wevtutil.exe cl "Microsoft-Windows-DirectShow-KernelSupport/Performance"
wevtutil.exe cl "Microsoft-Windows-DirectSound/Debug"
wevtutil.exe cl "Microsoft-Windows-DirectWrite-FontCache/Tracing"
wevtutil.exe cl "Microsoft-Windows-Disk/Operational"
wevtutil.exe cl "Microsoft-Windows-DiskDiagnostic/Operational"
wevtutil.exe cl "Microsoft-Windows-DiskDiagnosticDataCollector/Operational"
wevtutil.exe cl "Microsoft-Windows-DiskDiagnosticResolver/Operational"
wevtutil.exe cl "Microsoft-Windows-DisplayColorCalibration/Debug"
wevtutil.exe cl "Microsoft-Windows-DisplayColorCalibration/Operational"
wevtutil.exe cl "Microsoft-Windows-DisplaySwitch/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Documents/Performance"
wevtutil.exe cl "Microsoft-Windows-DriverFrameworks-UserMode/Operational"
wevtutil.exe cl "Microsoft-Windows-DxgKrnl/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-DxgKrnl/Performance"
wevtutil.exe cl "Microsoft-Windows-DxpTaskRingtone/Analytic"
wevtutil.exe cl "Microsoft-Windows-DxpTaskSyncProvider/Analytic"
wevtutil.exe cl "Microsoft-Windows-EFS/Debug"
wevtutil.exe cl "Microsoft-Windows-EapHost/Analytic"
wevtutil.exe cl "Microsoft-Windows-EapHost/Debug"
wevtutil.exe cl "Microsoft-Windows-EapHost/Operational"
wevtutil.exe cl "Microsoft-Windows-EaseOfAccess/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-EventCollector/Debug"
wevtutil.exe cl "Microsoft-Windows-EventCollector/Operational"
wevtutil.exe cl "Microsoft-Windows-EventLog-WMIProvider/Debug"
wevtutil.exe cl "Microsoft-Windows-EventLog/Analytic"
wevtutil.exe cl "Microsoft-Windows-EventLog/Debug"
wevtutil.exe cl "Microsoft-Windows-FMS/Analytic"
wevtutil.exe cl "Microsoft-Windows-FMS/Debug"
wevtutil.exe cl "Microsoft-Windows-FMS/Operational"
wevtutil.exe cl "Microsoft-Windows-FailoverClustering-Client/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Fault-Tolerant-Heap/Operational"
wevtutil.exe cl "Microsoft-Windows-Feedback-Service-TriggerProvider"
wevtutil.exe cl "Microsoft-Windows-FileInfoMinifilter/Operational"
wevtutil.exe cl "Microsoft-Windows-Firewall-CPL/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Folder Redirection/Operational"
wevtutil.exe cl "Microsoft-Windows-Forwarding/Debug"
wevtutil.exe cl "Microsoft-Windows-Forwarding/Operational"
wevtutil.exe cl "Microsoft-Windows-GettingStarted/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-GroupPolicy/Operational"
wevtutil.exe cl "Microsoft-Windows-HAL/Debug"
wevtutil.exe cl "Microsoft-Windows-HealthCenter/Debug"
wevtutil.exe cl "Microsoft-Windows-HealthCenter/Performance"
wevtutil.exe cl "Microsoft-Windows-HealthCenterCPL/Performance"
wevtutil.exe cl "Microsoft-Windows-Help/Operational"
wevtutil.exe cl "Microsoft-Windows-HomeGroup Control Panel Performance/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-HomeGroup Control Panel/Operational"
wevtutil.exe cl "Microsoft-Windows-HomeGroup Listener Service/Operational"
wevtutil.exe cl "Microsoft-Windows-HomeGroup Provider Service Performance/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-HomeGroup Provider Service/Operational"
wevtutil.exe cl "Microsoft-Windows-HomeGroup-ListenerService"
wevtutil.exe cl "Microsoft-Windows-HotStart/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-HttpService/Trace"
wevtutil.exe cl "Microsoft-Windows-IKE/Operational"
wevtutil.exe cl "Microsoft-Windows-IKEDBG/Debug"
wevtutil.exe cl "Microsoft-Windows-IPBusEnum/Tracing"
wevtutil.exe cl "Microsoft-Windows-IPSEC-SRV/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-International-RegionalOptionsControlPanel/Operational"
wevtutil.exe cl "Microsoft-Windows-International/Operational"
wevtutil.exe cl "Microsoft-Windows-Iphlpsvc/Debug"
wevtutil.exe cl "Microsoft-Windows-Iphlpsvc/Operational"
wevtutil.exe cl "Microsoft-Windows-Iphlpsvc/Trace"
wevtutil.exe cl "Microsoft-Windows-Kernel-Acpi/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Kernel-Boot/Analytic"
wevtutil.exe cl "Microsoft-Windows-Kernel-BootDiagnostics/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Kernel-Disk/Analytic"
wevtutil.exe cl "Microsoft-Windows-Kernel-EventTracing/Admin"
wevtutil.exe cl "Microsoft-Windows-Kernel-EventTracing/Analytic"
wevtutil.exe cl "Microsoft-Windows-Kernel-File/Analytic"
wevtutil.exe cl "Microsoft-Windows-Kernel-Memory/Analytic"
wevtutil.exe cl "Microsoft-Windows-Kernel-Network/Analytic"
wevtutil.exe cl "Microsoft-Windows-Kernel-PnP/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Kernel-Power/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Kernel-Power/Thermal-Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Kernel-Power/Thermal-Operational"
wevtutil.exe cl "Microsoft-Windows-Kernel-Prefetch/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Kernel-Process/Analytic"
wevtutil.exe cl "Microsoft-Windows-Kernel-Processor-Power/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Kernel-Registry/Analytic"
wevtutil.exe cl "Microsoft-Windows-Kernel-StoreMgr/Analytic"
wevtutil.exe cl "Microsoft-Windows-Kernel-StoreMgr/Operational"
wevtutil.exe cl "Microsoft-Windows-Kernel-WDI/Analytic"
wevtutil.exe cl "Microsoft-Windows-Kernel-WDI/Debug"
wevtutil.exe cl "Microsoft-Windows-Kernel-WDI/Operational"
wevtutil.exe cl "Microsoft-Windows-Kernel-WHEA/Errors"
wevtutil.exe cl "Microsoft-Windows-Kernel-WHEA/Operational"
wevtutil.exe cl "Microsoft-Windows-Known Folders API Service"
wevtutil.exe cl "Microsoft-Windows-L2NA/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-LDAP-Client/Debug"
wevtutil.exe cl "Microsoft-Windows-LUA-ConsentUI/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-LanguagePackSetup/Analytic"
wevtutil.exe cl "Microsoft-Windows-LanguagePackSetup/Debug"
wevtutil.exe cl "Microsoft-Windows-LanguagePackSetup/Operational"
wevtutil.exe cl "Microsoft-Windows-MCT/Operational"
wevtutil.exe cl "Microsoft-Windows-MPS-CLNT/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-MPS-DRV/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-MPS-SRV/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-MSPaint/Admin"
wevtutil.exe cl "Microsoft-Windows-MSPaint/Debug"
wevtutil.exe cl "Microsoft-Windows-MSPaint/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-MUI/Admin"
wevtutil.exe cl "Microsoft-Windows-MUI/Analytic"
wevtutil.exe cl "Microsoft-Windows-MUI/Debug"
wevtutil.exe cl "Microsoft-Windows-MUI/Operational"
wevtutil.exe cl "Microsoft-Windows-MediaFoundation-MFReadWrite/SinkWriter"
wevtutil.exe cl "Microsoft-Windows-MediaFoundation-MFReadWrite/SourceReader"
wevtutil.exe cl "Microsoft-Windows-MediaFoundation-MFReadWrite/Transform"
wevtutil.exe cl "Microsoft-Windows-MediaFoundation-PlayAPI/Analytic"
wevtutil.exe cl "Microsoft-Windows-MemoryDiagnostics-Results/Debug"
wevtutil.exe cl "Microsoft-Windows-MobilityCenter/Performance"
wevtutil.exe cl "Microsoft-Windows-NCSI/Analytic"
wevtutil.exe cl "Microsoft-Windows-NCSI/Operational"
wevtutil.exe cl "Microsoft-Windows-NDF-HelperClassDiscovery/Debug"
wevtutil.exe cl "Microsoft-Windows-NDIS-PacketCapture/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-NDIS/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-NDIS/Operational"
wevtutil.exe cl "Microsoft-Windows-NTLM/Operational"
wevtutil.exe cl "Microsoft-Windows-NWiFi/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Narrator/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-NetShell/Performance"
wevtutil.exe cl "Microsoft-Windows-Network-and-Sharing-Center/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-NetworkAccessProtection/Operational"
wevtutil.exe cl "Microsoft-Windows-NetworkAccessProtection/WHC"
wevtutil.exe cl "Microsoft-Windows-NetworkLocationWizard/Operational"
wevtutil.exe cl "Microsoft-Windows-NetworkProfile/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-NetworkProfile/Operational"
wevtutil.exe cl "Microsoft-Windows-Networking-Correlation/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-NlaSvc/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-NlaSvc/Operational"
wevtutil.exe cl "Microsoft-Windows-OLEACC/Debug"
wevtutil.exe cl "Microsoft-Windows-OLEACC/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-OOBE-Machine/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-OfflineFiles/Analytic"
wevtutil.exe cl "Microsoft-Windows-OfflineFiles/Debug"
wevtutil.exe cl "Microsoft-Windows-OfflineFiles/Operational"
wevtutil.exe cl "Microsoft-Windows-OfflineFiles/SyncLog"
wevtutil.exe cl "Microsoft-Windows-OneX/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-OobeLdr/Analytic"
wevtutil.exe cl "Microsoft-Windows-PCI/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-ParentalControls/Operational"
wevtutil.exe cl "Microsoft-Windows-PeerToPeerDrtEventProvider/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-PeopleNearMe/Operational"
wevtutil.exe cl "Microsoft-Windows-PortableDeviceStatusProvider/Analytic"
wevtutil.exe cl "Microsoft-Windows-PortableDeviceSyncProvider/Analytic"
wevtutil.exe cl "Microsoft-Windows-PowerCfg/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-PowerCpl/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-PowerEfficiencyDiagnostics/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-PowerShell/Analytic"
wevtutil.exe cl "Microsoft-Windows-PowerShell/Operational"
wevtutil.exe cl "Microsoft-Windows-PrimaryNetworkIcon/Performance"
wevtutil.exe cl "Microsoft-Windows-PrintService/Admin"
wevtutil.exe cl "Microsoft-Windows-PrintService/Debug"
wevtutil.exe cl "Microsoft-Windows-PrintService/Operational"
wevtutil.exe cl "Microsoft-Windows-Program-Compatibility-Assistant/Debug"
wevtutil.exe cl "Microsoft-Windows-QoS-Pacer/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-QoS-qWAVE/Debug"
wevtutil.exe cl "Microsoft-Windows-RPC/Debug"
wevtutil.exe cl "Microsoft-Windows-RPC/EEInfo"
wevtutil.exe cl "Microsoft-Windows-ReadyBoost/Analytic"
wevtutil.exe cl "Microsoft-Windows-ReadyBoost/Operational"
wevtutil.exe cl "Microsoft-Windows-ReadyBoostDriver/Analytic"
wevtutil.exe cl "Microsoft-Windows-ReadyBoostDriver/Operational"
wevtutil.exe cl "Microsoft-Windows-Recovery/Operational"
wevtutil.exe cl "Microsoft-Windows-ReliabilityAnalysisComponent/Operational"
wevtutil.exe cl "Microsoft-Windows-RemoteApp and Desktop Connections/Admin"
wevtutil.exe cl "Microsoft-Windows-RemoteAssistance/Admin"
wevtutil.exe cl "Microsoft-Windows-RemoteAssistance/Operational"
wevtutil.exe cl "Microsoft-Windows-RemoteAssistance/Tracing"
wevtutil.exe cl "Microsoft-Windows-Remotefs-UTProvider/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Resource-Exhaustion-Detector/Operational"
wevtutil.exe cl "Microsoft-Windows-Resource-Exhaustion-Resolver/Operational"
wevtutil.exe cl "Microsoft-Windows-Resource-Leak-Diagnostic/Operational"
wevtutil.exe cl "Microsoft-Windows-ResourcePublication/Tracing"
wevtutil.exe cl "Microsoft-Windows-RestartManager/Operational"
wevtutil.exe cl "Microsoft-Windows-Search-Core/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Search-ProtocolHandlers/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Security-Audit-Configuration-Client/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Security-Audit-Configuration-Client/Operational"
wevtutil.exe cl "Microsoft-Windows-Security-IdentityListener/Operational"
wevtutil.exe cl "Microsoft-Windows-Security-SPP/Perf"
wevtutil.exe cl "Microsoft-Windows-Sens/Debug"
wevtutil.exe cl "Microsoft-Windows-ServiceReportingApi/Debug"
wevtutil.exe cl "Microsoft-Windows-Services-Svchost/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Services/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Setup/Analytic"
wevtutil.exe cl "Microsoft-Windows-SetupCl/Analytic"
wevtutil.exe cl "Microsoft-Windows-SetupQueue/Analytic"
wevtutil.exe cl "Microsoft-Windows-SetupUGC/Analytic"
wevtutil.exe cl "Microsoft-Windows-ShareMedia-ControlPanel/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Shell-AuthUI-BootAnim/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Shell-AuthUI-Common/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Shell-AuthUI-CredUI/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Shell-AuthUI-Logon/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Shell-AuthUI-PasswordProvider/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Shell-AuthUI-Shutdown/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Shell-Core/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Shell-DefaultPrograms/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Shell-Shwebsvc"
wevtutil.exe cl "Microsoft-Windows-Shell-ZipFolder/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Shsvcs/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Sidebar/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Speech-UserExperience/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-StickyNotes/Admin"
wevtutil.exe cl "Microsoft-Windows-StickyNotes/Debug"
wevtutil.exe cl "Microsoft-Windows-StickyNotes/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-StorDiag/Operational"
wevtutil.exe cl "Microsoft-Windows-StorPort/Operational"
wevtutil.exe cl "Microsoft-Windows-Subsys-Csr/Operational"
wevtutil.exe cl "Microsoft-Windows-Subsys-SMSS/Operational"
wevtutil.exe cl "Microsoft-Windows-Superfetch/Main"
wevtutil.exe cl "Microsoft-Windows-Superfetch/StoreLog"
wevtutil.exe cl "Microsoft-Windows-Sysprep/Analytic"
wevtutil.exe cl "Microsoft-Windows-SystemHealthAgent/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-TCPIP/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-TSF-msctf/Debug"
wevtutil.exe cl "Microsoft-Windows-TSF-msctf/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-TSF-msutb/Debug"
wevtutil.exe cl "Microsoft-Windows-TSF-msutb/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-TZUtil/Operational"
wevtutil.exe cl "Microsoft-Windows-TaskScheduler/Debug"
wevtutil.exe cl "Microsoft-Windows-TaskScheduler/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-TaskScheduler/Operational"
wevtutil.exe cl "Microsoft-Windows-TaskbarCPL/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-TerminalServices-LocalSessionManager/Admin"
wevtutil.exe cl "Microsoft-Windows-TerminalServices-LocalSessionManager/Analytic"
wevtutil.exe cl "Microsoft-Windows-TerminalServices-LocalSessionManager/Debug"
wevtutil.exe cl "Microsoft-Windows-TerminalServices-LocalSessionManager/Operational"
wevtutil.exe cl "Microsoft-Windows-TerminalServices-MediaRedirection/Analytic"
wevtutil.exe cl "Microsoft-Windows-TerminalServices-PnPDevices/Admin"
wevtutil.exe cl "Microsoft-Windows-TerminalServices-PnPDevices/Analytic"
wevtutil.exe cl "Microsoft-Windows-TerminalServices-PnPDevices/Debug"
wevtutil.exe cl "Microsoft-Windows-TerminalServices-PnPDevices/Operational"
wevtutil.exe cl "Microsoft-Windows-TerminalServices-RDPClient/Analytic"
wevtutil.exe cl "Microsoft-Windows-TerminalServices-RDPClient/Debug"
wevtutil.exe cl "Microsoft-Windows-TerminalServices-RDPClient/Operational"
wevtutil.exe cl "Microsoft-Windows-TerminalServices-RdpSoundDriver/Capture"
wevtutil.exe cl "Microsoft-Windows-TerminalServices-RdpSoundDriver/Playback"
wevtutil.exe cl "Microsoft-Windows-TerminalServices-RemoteConnectionManager/Admin"
wevtutil.exe cl "Microsoft-Windows-TerminalServices-RemoteConnectionManager/Analytic"
wevtutil.exe cl "Microsoft-Windows-TerminalServices-RemoteConnectionManager/Debug"
wevtutil.exe cl "Microsoft-Windows-TerminalServices-RemoteConnectionManager/Operational"
wevtutil.exe cl "Microsoft-Windows-ThemeCPL/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-ThemeUI/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-TunnelDriver"
wevtutil.exe cl "Microsoft-Windows-UAC-FileVirtualization/Operational"
wevtutil.exe cl "Microsoft-Windows-UAC/Operational"
wevtutil.exe cl "Microsoft-Windows-UIAnimation/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-UIAutomationCore/Debug"
wevtutil.exe cl "Microsoft-Windows-UIAutomationCore/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-UIAutomationCore/Perf"
wevtutil.exe cl "Microsoft-Windows-UIRibbon/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-USB-USBHUB/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-USB-USBPORT/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-User Control Panel Performance/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-User Profile Service/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-User Profile Service/Operational"
wevtutil.exe cl "Microsoft-Windows-User-Loader/Analytic"
wevtutil.exe cl "Microsoft-Windows-UserModePowerService/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-UserPnp/DeviceMetadata/Debug"
wevtutil.exe cl "Microsoft-Windows-UserPnp/DeviceNotifications"
wevtutil.exe cl "Microsoft-Windows-UserPnp/Performance"
wevtutil.exe cl "Microsoft-Windows-UserPnp/SchedulerOperations"
wevtutil.exe cl "Microsoft-Windows-UxTheme/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-VAN/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-VDRVROOT/Operational"
wevtutil.exe cl "Microsoft-Windows-VHDMP/Operational"
wevtutil.exe cl "Microsoft-Windows-VWiFi/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-VolumeControl/Performance"
wevtutil.exe cl "Microsoft-Windows-VolumeSnapshot-Driver/Operational"
wevtutil.exe cl "Microsoft-Windows-WABSyncProvider/Analytic"
wevtutil.exe cl "Microsoft-Windows-WCN-Config-Registrar/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-WER-Diag/Operational"
wevtutil.exe cl "Microsoft-Windows-WFP/Analytic"
wevtutil.exe cl "Microsoft-Windows-WFP/Operational"
wevtutil.exe cl "Microsoft-Windows-WLAN-AutoConfig/Operational"
wevtutil.exe cl "Microsoft-Windows-WLAN-Autoconfig/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-WLANConnectionFlow/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-WMI-Activity/Trace"
wevtutil.exe cl "Microsoft-Windows-WMPDMCCore/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-WMPDMCUI/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-WMPNSS-PublicAPI/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-WMPNSS-Service/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-WMPNSSUI/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-WPD-ClassInstaller/Analytic"
wevtutil.exe cl "Microsoft-Windows-WPD-ClassInstaller/Operational"
wevtutil.exe cl "Microsoft-Windows-WPD-CompositeClassDriver/Analytic"
wevtutil.exe cl "Microsoft-Windows-WPD-CompositeClassDriver/Operational"
wevtutil.exe cl "Microsoft-Windows-WPD-MTPClassDriver/Operational"
wevtutil.exe cl "Microsoft-Windows-WSC-SRV/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-WUSA/Debug"
wevtutil.exe cl "Microsoft-Windows-WWAN-MM-Events/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-WWAN-NDISUIO-EVENTS/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-WWAN-SVC-Events/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-WWAN-UI-Events/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-WebIO-NDF/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-WebIO/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-WebServices/Tracing"
wevtutil.exe cl "Microsoft-Windows-Win32k/Concurrency"
wevtutil.exe cl "Microsoft-Windows-Win32k/Power"
wevtutil.exe cl "Microsoft-Windows-Win32k/Render"
wevtutil.exe cl "Microsoft-Windows-Win32k/Tracing"
wevtutil.exe cl "Microsoft-Windows-Win32k/UIPI"
wevtutil.exe cl "Microsoft-Windows-WinHTTP-NDF/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-WinHttp/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-WinINet/Analytic"
wevtutil.exe cl "Microsoft-Windows-WinRM/Analytic"
wevtutil.exe cl "Microsoft-Windows-WinRM/Debug"
wevtutil.exe cl "Microsoft-Windows-WinRM/Operational"
wevtutil.exe cl "Microsoft-Windows-Windeploy/Analytic"
wevtutil.exe cl "Microsoft-Windows-Windows Defender/Operational"
wevtutil.exe cl "Microsoft-Windows-Windows Defender/WHC"
wevtutil.exe cl "Microsoft-Windows-Windows Firewall With Advanced Security/ConnectionSecurity"
wevtutil.exe cl "Microsoft-Windows-Windows Firewall With Advanced Security/ConnectionSecurityVerbose"
wevtutil.exe cl "Microsoft-Windows-Windows Firewall With Advanced Security/Firewall"
wevtutil.exe cl "Microsoft-Windows-Windows Firewall With Advanced Security/FirewallVerbose"
wevtutil.exe cl "Microsoft-Windows-WindowsBackup/ActionCenter"
wevtutil.exe cl "Microsoft-Windows-WindowsColorSystem/Debug"
wevtutil.exe cl "Microsoft-Windows-WindowsColorSystem/Operational"
wevtutil.exe cl "Microsoft-Windows-WindowsSystemAssessmentTool/Operational"
wevtutil.exe cl "Microsoft-Windows-WindowsSystemAssessmentTool/Tracing"
wevtutil.exe cl "Microsoft-Windows-WindowsUpdateClient/Operational"
wevtutil.exe cl "Microsoft-Windows-Wininit/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Winlogon/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Winlogon/Operational"
wevtutil.exe cl "Microsoft-Windows-Winsock-AFD/Operational"
wevtutil.exe cl "Microsoft-Windows-Winsock-WS2HELP/Operational"
wevtutil.exe cl "Microsoft-Windows-Winsrv/Analytic"
wevtutil.exe cl "Microsoft-Windows-Wired-AutoConfig/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-Wired-AutoConfig/Operational"
wevtutil.exe cl "Microsoft-Windows-Wordpad/Admin"
wevtutil.exe cl "Microsoft-Windows-Wordpad/Debug"
wevtutil.exe cl "Microsoft-Windows-Wordpad/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-mobsync/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-ntshrui"
wevtutil.exe cl "Microsoft-Windows-osk/Diagnostic"
wevtutil.exe cl "Microsoft-Windows-stobject/Diagnostic"
wevtutil.exe cl "OAlerts"
wevtutil.exe cl "Security"
wevtutil.exe cl "Setup"
wevtutil.exe cl "System"
wevtutil.exe cl "TabletPC_InputPanel_Channel"
wevtutil.exe cl "WINDOWS_MP4SDECD_CHANNEL"
wevtutil.exe cl "WMPSetup"
wevtutil.exe cl "WMPSyncEngine"
wevtutil.exe cl "Windows PowerShell"
wevtutil.exe cl "muxencode"
echo --------------------------------------------------
echo Script cleared Windows 7 event logs.
echo --------------------------------------------------
Option 2: Use the shorter script Code 1 line Copy 1
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.
References Older post Outlook 2011 for Mac: Import a Windows PST file
Newer post PowerShell: Clear Windows event logs
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"
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.
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.
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.
[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"