Posted on 06/26/2023 3:18:01 PM PDT by entropy12
Windows 10 just loves to create Log files. Those take up space on hard drive. In 28 years of using Windows, I never have found any use for these log files. May be Bill Gates looks at them from your PC. To me they are totally useless, taking up space and slowing down my PC by few micro-seconds for each access. I created this program to delete every one of those log files. Simply double click on the shortcut Logs-Del on your main desktop window and the program does the rest. This program deletes only LOG files, nothing else.
Create Folder C:\LogFiles Using Notepad editor, open a new text file. Copy and paste following Powershell command into that text file:
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& {Start-Process PowerShell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""C:\LogFiles\Logs-Del.ps1""' -Verb RunAs}"
Save that text file with name Logs-Del.bat into the already created folder C:\LogFiles
Using Notepad editor, open a new text file. Copy and paste following 6 lines into that text file:
Get-EventLog -LogName * -PipelineVariable log timeout /t 10 wevtutil el | Foreach-Object {Write-Host "Clearing $_"; wevtutil cl "$_"} timeout /t 01 Get-EventLog -LogName * -PipelineVariable log timeout /t 10
Save that text file with name Logs-Del.ps1 into created folder C:\LogFiles
You are almost done! Using Windows File Explorer, right click on C:/LogFiles/Logs-Del.bat and send it to Desktop.
Now you will have a shortcut on your main screen called Logs-Del. To run this program Double click on it.
When PowerShell is entered, program will pause and ask your permission to proceed. You can either proceed or abort.
First this program will list all the log files in your Windows Folder. Make a note of how many log files are taking up space just for fun.
You will have 10 seconds yo make a note of this list of log files. Next the program will search all sub-folders inside Windows folder and delete them. You will see display of each Windows folder undergoing search for Log files.
When all done, program will display new count of log files remaining in Windows folder. You will have 10 seconds to read this small list.
those 6 lines got combined by FR editor.
They look like below:
Get-EventLog -LogName * -PipelineVariable log
timeout /t 10
wevtutil el | Foreach-Object {Write-Host “Clearing $_”; wevtutil cl “$_”}
timeout /t 01
Get-EventLog -LogName * -PipelineVariable log
timeout /t 10
Bkmk
Later.
No. I delete them all the time.
the biggest win by far is to disable automatic CBS logging via the registry ... I’ve seen this fill up system drives and prevent booting ... AND CBS logging is utterly useless ...
Later
Thanks. I’ll look into it.
.
Does this apply to Win-7 Pro x64?
Most of us with IT Certifications know EXACTLY what these files are used for.
(unfortunately, I don’t have any IT certifications)
With Windows Explorer, I found 241 *.LOG files; largest is 3,790kb, but most were under 10kb.
I don’t see why not.
I have been using MD-DOS since 1986, and Windows since 1995, NOT ONCE I had any use out of this LOG files. I was manager of a huge engineering group using many different types of work stations. Not even once I had any use out of these Log files. My PC usually has 10-15k of them at any one time.
I have been working with PC’s since 1986. Can’t remember even once I learned anything useful looking at Log files.
Should I make a copy of the folder, before just deleting them manually?
No because there are like 5000 folders and sub-folders inside Windows main folder and you do not always have permissions to delete them. The program I posted acts as administrator temporarily and can delete any log file out there.
There are so many sub-folders inside Windows main folder, it will take better part of whole day to find all those sub-folders.
I have used this program dozens of times on various different PC’s and never had to backup anything before running this.
Disclaimer: Opinions posted on Free Republic are those of the individual posters and do not necessarily represent the opinion of Free Republic or its management. All materials posted herein are protected by copyright law and the exemption for fair use of copyrighted works.