Failed to delete Logs folder inside - C:\Windows\System32\winevt

I found event log folder consumed 79GB in my windows 2008 r2 server. I treid to delete the logs inside folder path - C:\Windows\System32\winevt, but failed as it prompting the filde folder in use.

Please advice how may i delete this folder log
Doodad BoySupprtAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Omar SoudaniSenior System EngineerCommented:
Hello ThereSystem AdministratorCommented:
Use this script. Save it as BAT file and Run As Administrator:
@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 goto theEnd
:do_clear
echo clearing %1
wevtutil.exe cl %1
goto :eof
:noAdmin
exit

Open in new window


Otherwise you have to take ownership over the parent folder (Sysem owns it now I guess). Then you have to enter the Safe Mode, log on as administrator and delete these folders/files. There is no other way if the system uses it.

I would also set a few rules for these logs.
Open Event Viewer and in each Event Log's properties you can set if you want to overwrite older events in the log, or archive events in the log, or not overwrite the log (clear manually).

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
arnoldCommented:
Sort on date modified,delete files older than a week.
Current files can not be deleted. Identifying what creates these files, and possibly altering the location where they are stored and/or limiting the logging settings.
Open eventvwr and check your settings for the various entries.

Is this system configured as a central repository (event forwarder) IE you have splunk or similar aggregator of events.
Sudhir TonseCommented:
Hi,

You can try another option .Go to Event viewer and delete the  logs manually .
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows OS

From novice to tech pro — start learning today.