Очистка журнала событий windows 10 cmd

В Windows вы можете очистить журналы событий Event Viewer с помощью графической оснастки eventvwr.msc, из командной строки и с помощью PowerShell.

Содержание:

  • Очистка журнал событий из графической консоли Event Viewer
  • Удаление логов Windows из командной строки
  • Clear-EventLog: команда PowerShell для очистки журналов событий

Очистка журнал событий из графической консоли Event Viewer

Самый интуитивный способ очистки журналов событий Windows – воспользоваться графической консоль Event Viewer.

  1. Запустите консоль
    eventvwr.msc
    ;

    Очистка журналов из консоли просмотра событий

  2. Щелкните правой кнопкой по журналу и выберите Clear Log;

Такой способ позволяет быстро удалить все события из одного конкретного журнала. Однако в Windows используется несколько сотен журналов для разных компонентов операционной системы и стороннего ПО.

По умолчанию Windows хранит журналы в файлах с расширением EVTX в каталоге
%SystemRoot%\System32\Winevt\Logs\
.

Каталог System32\Winevt\Logs с EVTX логами WIndows

Если вам нужно очистить их все – это будет утомительно вручную прощелкать все разделы Event Viewer и очистить каждый журнал. В этом случае для удаления событий лучше использовать PowerShell или командную строку.

Удаление логов Windows из командной строки

Для очистки журналов Windows из командной строки используется утилита wevtutil.exe.

Вывести список зарегистрированных в Windows журналов событий:

WevtUtil enum-logs

или короткий вариант:

WevtUtil el

Для удаления событий из одного конкретного журнала, скопируйте его имя и выполните команду:

WevtUtil cl Microsoft-Windows-GroupPolicy/Operational

Перед очисткой можно создать резервную копию событий в журнале в отдельный файл:

WevtUtil cl Microsoft-Windows-GroupPolicy/Operational /bu:GPOLOG_Bak.evtx

Можно очистить сразу все журналы событий из cmd.exe:

for /F "tokens=*" %1 in ('wevtutil.exe el') DO wevtutil.exe cl "%1"

Для BAT файла нужно использовать немного другой синтаксис:

for /F "tokens=*" %%1 in ('wevtutil.exe el') DO wevtutil.exe cl "%%1"

Clear-EventLog: команда PowerShell для очистки журналов событий

В PowerShell для получения списка журналов событий Windows и их очистки можно использовать командлеты Get-WinEvent и Clear-EventLog.

Откройте консоль PowerShell с правами администратора, выведите список всех имен журналов в Windows и их настройки:

Get-WinEvent -ListLog *

get-winevent вывести список журналов event viewer в windows

Команда выведет максимальные размеры и параметры всех журналов событий Windows.

Чтобы удалить все события из двух журналов (например, журналов Security и System), выполните команду:

Clear-EventLog –LogName Security,System

При этом журнал очищается, и в него записывается событие с EventID 104 или 1102 с временем очистки, пользователем, выполнившим и описанием:

The System log file was cleared
The audit log was cleared.

Очистка журналов фиксируется событием EventId 104 с текстом «The System log file was cleared»

Для очистки административных и операционных журналов событий Windows, выполните такую однострочную команду PowerShell:

Get-WinEvent -ListLog * -Force | % { Wevtutil.exe cl $_.Logname }

Или:

wevtutil el | Foreach-Object {wevtutil cl "$_"}

Примечание. В нашем примере не удалось очистить 3 журнала из-за ошибки доступа. Попробуйте вручную очистить содержимое этих журналов из консоли Event Viewer.

Wevtutil полная очистка журналов событий Windows

Способ 1: Контекстное меню журнала

Очистить журнал событий в операционной системе Windows 10 можно путем использования функции контекстного меню соответствующего элемента. Делается это непосредственно в утилите просмотра событий, поэтому предварительно откройте ее. Если вы не знаете, как это сделать, ознакомьтесь с соответствующей статьей на нашем сайте, в ней автор предлагает несколько способов выполнения поставленной задачи.

Подробнее: Как посмотреть журнал событий в операционной системе Windows 10

как очистить журнал событий в windows 10_01

После появления на экране окна «Просмотр событий» разверните на боковой панели слева каталог «Журналы Windows» и кликните правой кнопкой мыши по первому элементу из появившегося списка. На изображении ниже это пункт «Приложение». В появившемся контекстном меню нажмите по строке «Очистить журнал».

как очистить журнал событий в windows 10_02

Подтвердите свои действия, щелкнув в открывшемся диалоговом окне по кнопке «Очистить». Сразу после этого все записи журнала исчезнут. Чтобы очистить журнал событий полностью, проделайте такие же действия с другими пунктами из списка «Журналы Windows».

как очистить журнал событий в windows 10_03

В конечном итоге, какой бы журнал для просмотра вы не выбрали, он будет пустым, о чем свидетельствует отсутствие записей в соответствующем интерфейсе утилиты.

как очистить журнал событий в windows 10_11

Способ 2: «Командная строка»

Если вы не хотите вручную чистить каждый журнал Windows 10, воспользуйтесь «Командной строкой». Для выполнения поставленной задачи потребуется ввести всего одну команду, но консоль обязательно должна быть запущена с повышенными привилегиями. Для этого можно воспользоваться поиском по системе. Установите курсор в соответствующее поле на панели задач, введите запрос «Командная строка», а затем в результатах щелкните по пункту «Запуск от имени администратора». Затем в появившемся диалоговом окне контроля учетных записей подтвердите запуск, кликнув по кнопке «Да».

как очистить журнал событий в windows 10_04

Читайте также: Запуск «Командной строки» от имени администратора в Windows 10

В открывшейся консоли введите приведенную ниже команду и нажмите Enter для ее выполнения. Это мгновенно удалит все данные из журнала событий.

for /F "tokens=*" %1 in ('wevtutil.exe el') DO wevtutil.exe cl "%1"

как очистить журнал событий в windows 10_05

Примечание! Не обязательно вписывать эту команду в консоль вручную, вы можете ее скопировать в буфер обмена сочетанием Ctrl + C (предварительно выделив), а затем вставить в «Командную строку», щелкнув правой кнопкой мыши.

Стоит отметить, что через консоль можно удалять журналы выборочно. Для этого достаточно знать только название нужного. Для отображения списка их имен воспользуйтесь приведенной ниже командой.

wevtutil el|more

как очистить журнал событий в windows 10_06

Найдя в списке название журнала, выполните другую команду, показанную ниже, заменив [название_журнала] на выбранное из списка наименование. В примере ниже на скриншоте вы можете видеть как происходит очистка журнала «HradwareEvents».

wevtutil.exe cl [название_журнала]

как очистить журнал событий в windows 10_07

Обратите внимание, что после выполнения команды никакого отчета не последует, необходимо дождаться только появления нового запроса на ввод команды — это будет символизировать удачное выполнение процедуры.

Способ 3: «PowerShell»

Очистить журнал событий в Windows 10 можно посредством ввода специальной команды в оболочку «PowerShell». Для успешного выполнения поставленной задачи она должна быть запущена от имени администратора. Для этого можно воспользоваться поиском по системе или контекстным меню кнопки «Пуск». Во втором случае щелкните правой кнопкой мыши по кнопке и в появившемся списке выберите пункт «Windows PowerShell (администратор)». В открывшемся после этого диалоговом окне нажмите «Да».

Читайте также: Запуск «PowerShell» в операционной системе Windows 10

Чтобы очистить все журналы событий в Windows 10, потребуется воспользоваться приведенной ниже командой. Скопируйте ее в буфер обмена и вставьте в консоль правой кнопкой мыши. После этого нажмите Enter для выполнения.

wevtutil el | Foreach-Object {wevtutil cl "$_"}

как очистить журнал событий в windows 10_09

Обратите внимание! В течение выполнения операции на экране будут появляться надписи «Не удалось очистить журнал …» и «Отказано в доступе». Это происходит по той причине, что некоторые журналы являются важными для операционной системы и их удалить невозможно.

После этого вы можете убедиться в том, что процедура прошла успешно. Для этого откройте утилиту «Просмотр событий» и поочередно просмотрите все пункты в каталоге «Журналы Windows» — они будут пустыми.

как очистить журнал событий в windows 10_10

Важно! После проделанных действий журнал событий со временем снова начнет заполняться новой информацией. Чтобы систематически не приходилось его чистить одним из описанных в статье способом, можно отключить в Windows 10 специальную службу, отвечающую за сбор информации. На эту тему у нас есть отдельная статья, в которой подробно рассказывается о том, как это сделать. При необходимости ознакомьтесь с ней, перейдя по ссылке ниже.

Подробнее: Как отключить «Журнал событий» в Windows 10

как очистить журнал событий в windows 10_12

Наша группа в TelegramПолезные советы и помощь

  • Home
  • Partition Manager
  • How to Clear All Event Logs in Event Viewer Windows 11/10

By Ariel | Follow |
Last Updated

A great many people want to clear all event logs in Event Viewer. How to clear all event logs in Event Viewer Windows 11/10? In this post, MiniTool summarizes 4 simple ways to clear event logs quickly.

Event Viewer is a component of Microsoft’s Windows NT operating system (OS) that enables administrators and advanced users to view the event logs on a local or remote computer. The event logs can record significant events on your system, such as when your program encounters an error that you can find helpful information in the event log to fix the error.

Sometimes, however, you may want to clear all event logs in Event Viewer Windows 11/10 once there is nothing wrong. Here are 4 ways:

Note: To clear all event logs in Event Viewer Windows 11/10, you must be signed in as an administrator and make sure the Windows Event Log service is enabled and running.

Way 1. Clear All Event Logs in Event Viewer

Step 1. Press Win + R keys to open the Run dialog box, and then type eventvwr.msc in it and hit Enter.

open Event Viewer via the Run box

Step 2. Expand the Windows Logs category from the left sidebar, and then right-click a log (ex: Application) and select Clear Log.

select Clear Log in Event Viewer

Step 3. Click on Clear in the pop-up confirmation window.

click on Clear in the Event Viewer window

Here’s how to clear all event logs Windows 11. Also, you can try the following 4 methods.

Way 2. Clear Event Logs Using Command Prompt

Step 1. Type cmd in the search box, and then right-click the Command Prompt from the top result and select Run as administrator. Then click on Yes in the UAC window to confirm it.

Step 2. In the elevated Command Prompt, type the following command and hit Enter.

for /F “tokens=*” %1 in (‘wevtutil.exe el’) DO wevtutil.exe cl “%1”

clear all event logs using the elevated Command Prompt

Once you clear all event logs Windows 11, you can close the Command Prompt window.

Way 3. Clear Event Logs Using Windows PowerShell

In addition to using Command Prompt, Windows PowerShell can help you clear event logs in Windows 11/10. Here’s how:

Step 1. Type powershell in the search box, and then right-click Windows PowerShell from the top result and select Run as administrator. Then click on Yes in the UAC window.

Step 2. In the elevated PowerShell window, type the following command and hit Enter to clear all event logs. Once done, close Windows PowerShell.

Get-EventLog -LogName * | ForEach { Clear-EventLog $_.Log }

clear event logs via Windows PowerShell

Way 4. Clear Event Logs Using a BAT File

You also can clear event logs in Windows 11/10 directly using a BAT file. For that:

Step 1. Clear here to download the Clear_Event_Viewer_Logs.bat file and save it to your desktop.

Step 2. Double click the bat file and click on Run in the pop-up window to unblock the file.

Step 3. Right-click the .bat file and select Run as administrator. Click on Yes if you are prompted by UAC. After that, an elevated Command Prompt will start clearing the event logs. Once finished, the Command Prompt window will automatically close.

How to clear all event logs Windows 11/10? The top 4 methods have been illustrated. Now, it’s your turn to have a try.

About The Author

Position: Columnist

Ariel has been working as a highly professional computer-relevant technology editor at MiniTool for many years. She has a strong passion for researching all knowledge related to the computer’s disk, partition, and Windows OS. Up till now, she has finished thousands of articles covering a broad range of topics and helped lots of users fix various problems. She focuses on the fields of disk management, OS backup, and PDF editing and provides her readers with insightful and informative content.

This post explains how to view or clear the Event Log in the Event Viewer (eventvwr.msc) on a Windows PC. Windows 11/10 OS may occasionally throw up errors, and at such times, you may want to get a deeper understanding of the errors. That’s where the Event Log comes into play. Event Log files basically store all information regarding past errors. The problem is that the Event Log sometimes doesn’t automatically remove all the information it stores, and that can be a problem.

How to clear the Event Log in Windows

To fix this, users must manually clear the Event Log. Do you know what? Most computer users have no idea of how to do this. Worry not; we’ll help you through the entire process, and when we’re done, you’ll be a master.

Read: How to use Event Viewer in Windows 11

This post shows you how to clear the Event Log files via the Event Viewer UI or the Command line. You can delete all or selected even log files also from your Windows/Server, by following the steps laid down in this tutorial.

1] Clear the Event Log using the Event Viewer

clear the Event Log using Event Viewer

Click on the Start button then type eventvwr.msc or Event Viewer. When you see the icon, right-click on it and select Run as Administrator to launch the Event Viewer. Finally, double-click on the folders in the left pane, right-click on the events you want to have deleted, and then choose Clear Log. This will clear all log files for that section. You may also select a log file and then click on Clear log which you see on the right-side panel.

2] Delete selected Event logs using the wevtutil tool

Clear event log using wevtutil tool

You can use the Command Prompt instead. So let us see how to clear the Event Log using the Command Prompt on a Windows 11/10 PC.

Click on the Start button, then type cmd and you’ll see the CMD icon. Right-click on the icon, then select Run as Administrator to fire up the Command Prompt.

The next step, then, is to type wevtutil el into the newly opened Command Prompt window and make sure to do this without the quotes. Click the Enter key on your keyboard, and in a moment, you should see a list of all the error logs that have been exported.

Finally, type wevtutil cl + the name of the log you want to remove. This option allows you to clear only the logs you do not want, so don’t expect it to clear everything at the same time.

WEVTUTIL.exe is a built-in tool that lets you to retrieve information about event logs and publishers. You can also use this command to install and uninstall event manifests, run queries, and export, archive, and clear logs.

Read: How to export Event Viewer logs in Windows

3] Remove all Event Log files using a .CMD file

To clear everything, launch the Notepad application then copy and paste the following piece of information which has been sourced from MSDN:

@echo off
FOR /F "tokens=1,2*" %%V IN ('bcdedit') DO SET adminTest=%%V
IF (%adminTest%)==(Access) goto noAdmin
for /F "tokens=*" %%G in ('wevtutil.exe el') DO (call :do_clear "%%G")
echo.
echo Event Logs have been cleared! ^<press any key^>
goto theEnd
:do_clear
echo clearing %1
wevtutil.exe cl %1
goto :eof
:noAdmin
echo You must run this script as an Administrator!
echo ^<press any key^>
:theEnd
pause>NUL

Be sure to save the data as a .bat file, then finally, right-click on the saved file and select Run as Administrator. From there, the Command Prompt should launch by itself, and all you need to do is allow it to finish doing its stuff.

I hope this helps!

Read: How to delete corrupt Event Viewer Log files

How to clear out the Event Logs in Windows?

To clear all event logs that have entries in Windows, open an elevated PowerShell prompt and execute the following:

Get-EventLog -LogName * | where {$_.Entries.Count -gt 0} | foreach {Clear-EventLog $_.Log}

Read: Enable or disable Protected Event Logging in Windows.

How to view and delete Event Viewer Saved Error Logs?

If you are a regular of Event Viewer and you frequently view many .evt or .evtx files in Event Viewer, you may have noticed that a large number of files end up accumulating under Saved Logs. These entries remain even if you delete the original .evt and .evtx files.

These Saved Logs are stored .xml format, in the ExternalLogs folder,  which is hidden. To view this folder, first through the folder options, uncheck the hidden and system files options, and navigate to the following path:

C:\ProgramData\Microsoft\Event Viewer\ExternalLogs

You will see the .xml logs here. The contents of this folder are hidden so you must turn on Show Hidden Files and turn off Hide Protected Operating System Files to see them.

To open a saved event log, start Event Viewer. Now, in the Actions menu, click Open Saved Log and navigate to and select the Saved Log from its location.

You can delete the Saved Logs from the Actions Box. But when you delete the log from the Event Manager’s Actions Box, you are only removing it from the console tree; you are not deleting the log file from the system.

If you wish you can delete the logs from your system, you will have to navigate to the mentioned ExternalLogs folder and delete them manually. Make sure that the Event Viewer is closed when you delete these files.

Windows Event Viewer Plus, a portable freeware app that lets you view Event Logs faster than the default inbuilt Windows Event Viewer, may also interest you.

How do I delete the Windows activity log?

Press Win + I to open the Settings app. Click on Privacy & security in the left panel. Scroll down and select Activity history. Click the Clear history button next to the ‘Clear activity history for this account’ option. This will delete the activity history stored on your device. To delete activity history stored online in your Microsoft account, go to your Microsoft Privacy Dashboard. You will see various categories, such as Browsing and search, Apps and services, etc. Click the category for the type of data you want to delete and select the Clear all activities option.

What is clear Event log?

The Clear-EventLog cmdlet in PowerShell deletes all entries from a specified event log on a local or remote computer. It lets you clear event logs such as Application, System, Security, or a custom log. The cmdlet can be helpful for maintenance tasks, troubleshooting, or clearing out no longer required logs. Clearing event logs permanently deletes all entries in the specified log, so it’s essential to use the Clear-EventLog cmdlet carefully and only when necessary.

Related reads that are sure to interest you:

  1. How to view Event Logs in Windows in detail with Full Event Log View
  2. Use Event Viewer to check unauthorized use of Windows computer
  3. How to create Custom Views in Event Viewer on Windows
  4. Enhanced Event Viewer for Windows from Technet
  5. Event Log Manager Free event log management software
  6. Monitor Windows Event Log Files Checking with SnakeTail Windows tail utility
  7. Event Log Manager & Event Log Explorer software.

Skip to content

Often when you want to troubleshoot issues or keep a general check on your system health in Windows 10, you have to use Event Viewer. Event Viewer shows all the Windows events that get logged such as Information, Errors, Warnings and so on. Besides errors, Windows logs completely normal activities. This makes it harder to spot events related to things that aren’t working as expected. So from time to time you may need to clear the Event Log in Windows 10.

windows-10-event-log-app

The System Log and the Application Log are two of the important logs that you may want to clear occasionally. There are several ways to do it.

Clear All Event Logs in Windows 10 manually

You can manually clear any Event Log by right clicking it and choosing «Clear log…» from the right click menu.

  1. Right click the Start button or press Win + X to open the Win+X menu (Power User Menu) in Windows 10.
  2. Choose the item Computer Management from the context menu.
    Windows 10 open computer management

  3. Go to Computer Management — System Tools — Event Viewer — Windows Logs:
    windows-logs

  4. Right click the log you would like to clear and select the command Clear Log… from the context menu:
    clear-log-context-menu-command

You are done.

Clear All Event Logs in Windows 10 using Command Prompt

You can quickly clear all event logs using a special command. Do it as follows.

  1. Open an elevated command prompt.
  2. Type or paste the following command:
    for /F "tokens=*" %1 in ('wevtutil.exe el') DO wevtutil.exe cl "%1"

This will produce the following output:

windows-10-clear-logs-from-cmd

All Windows logs will be cleared. Instead, you might want to clear individual logs. Do it as follows.

    1. Open an elevated command prompt.
    2. Type or paste the following command:
      wevtutil el|more

It will produce the list of available logs.

cmd-list-of-logs

Note the name of the log you need to clear.

  • To clear a specific log, type the following command:
    wevtutil.exe cl log_name_here

    Replace the log_name_here portion with the name of the log you need to clear. For example, this will clear the «Application» log:

    wevtutil.exe cl Application

    windows-10-clear-application-log-from-cmd

How to clear all Event Logs using PowerShell

  1. Open PowerShell as administrator (see how).
  2. Type or copy-paste the following command into PowerShell:
    wevtutil el | Foreach-Object {wevtutil cl "$_"}

    windows-10-clear-logs-from-ps

  3. Press Enter. Wait for few seconds for all logs to be cleared. You can now exit PowerShell by typing Exit.

That’s it.

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won’t take a lot from you, but it will help us grow. Thanks for your support!

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • При открытии internet explorer открывается edge windows 10 как исправить
  • Какая кнопка открывает оглавление справочной системы windows
  • Где посмотреть модель материнской платы в windows 11
  • Приколюхи для windows 11
  • Полное отключение телеметрии windows 10