Question

In the task scheduler GUI it is easy to Enable All Tasks History

See also https://stackoverflow.com/questions/11013132/how-can-i-enable-the-windows-server-task-scheduler-history-recording

Enable All Tasks History button in GUI

How can I Enable All Tasks History through PowerShell?

I have looked at Set-ScheduledTask and New-ScheduledTask, but nothing useful there (as far as I can see).

Was it helpful?

Solution

After doing a bunch of research, I found that the History tab is just a view of a windows event log, displayed using MMC snapin. So really, all that button is doing is disabling / enabling the windows event log for the task scheduler. Here is the script to automate pushing of that button :

$logName = 'Microsoft-Windows-TaskScheduler/Operational'
$log = New-Object System.Diagnostics.Eventing.Reader.EventLogConfiguration $logName
$log.IsEnabled=$true
$log.SaveChanges()

Sources that got me there: http://windows.microsoft.com/en-us/windows-vista/automate-tasks-with-task-scheduler-from-windows-vista-inside-out
http://www.powershellmagazine.com/2013/07/15/pstip-how-to-enable-event-logs-using-windows-powershell/

OTHER TIPS

From an elevated command prompt or PowerShell

wevtutil set-log Microsoft-Windows-TaskScheduler/Operational /enabled:true

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top