Windows

Enable All Windows Events Logs Archiving

October 31, 2018 Rich 1 min read

This PowerShell script will enable retention for all Windows event logs. This will create an archive log file and start a new log file when it reaches the maximum configured log size (usually 20MB).

# Get all event log names
$logs = wevtutil el

# Loop through each log and enable archiving
foreach ($log in $logs) {
# Enable archiving for the current log
wevtutil sl $log /ab:true /rt:true
Write-Output "Archive enabled for log: $log"
}

Leave a comment