skip to main content

Set max log size for Task Scheduler

Today I have found that the maximum log size for task scheduler can be set in the Windows registry. Its default size is 10MB.

First, get and set the relevant registry key. Then set the max log size to 100MB. Once this is done, we need to restart the Task Scheduler service.

$key = get-item 'HKLM:\SOFTWARE\Microsoft\SchedulingAgent'
$values = Get-ItemProperty $key.PSPath
Set-ItemProperty -path "HKLM:\SOFTWARE\Microsoft\SchedulingAgent" -name "MaxLogSizeKB" -value 102400
$values = Get-ItemProperty $key.PSPath
write-host $values.MaxLogSizeKB
restart-service -displayname "Task Scheduler"