It does clear event logs without fuss. I prefer my own program to clean event logs but Zero works okay.
I prefer knowing the filesizes for event logs before I delete them so I use this PowerShell script:
Code:
# Define the log directory (usually C:\Windows\System32\winevt\Logs)
$logDirectory = "C:\Windows\System32\winevt\Logs"
# Get all log files and their sizes
$logFiles = Get-ChildItem -Path $logDirectory -Recurse -File
# Initialize total size
$totalSize = 0
# List each log file with its size
Write-Host "Log Files and Sizes:"
foreach ($file in $logFiles) {
$fileSizeMB = [math]::Round(($file.Length / 1MB), 2)
$totalSize += $fileSizeMB
Write-Host "$($file.FullName) - $fileSizeMB MB"
}
# Display the total size
$totalSize = [math]::Round($totalSize, 2)
Write-Host "`n"
Write-Host "Total Size of Log Files: $totalSize MB"
# Option to delete the log files
Write-Host "`n"
$delete = Read-Host "Do you want to delete all log files? (Y/N)"
if ($delete -eq 'Y' -or $delete -eq 'y') {
foreach ($file in $logFiles) {
Remove-Item -Path $file.FullName -Force
Write-Host "Deleted: $($file.FullName)"
}
Write-Host "All log files have been deleted."
} else {
Write-Host "No log files were deleted."
}
This lists the logs and their filesizes and adds a total at the end before giving an option to delete them:
Hope this helps...