Required Files: None
This will log the list of Windows Scheduled Tasks and compare it each time you run. If the set changes it will alert.
Import-Module $env:SyncroModule $oldFile = "C:\temp\tasks-old.txt" $newFile = "C:\temp\tasks-new.txt" if(!(test-path C:\temp)){ mkdir C:\temp } $oldFilePresent = Test-Path -Path $oldFile $newFilePresent = Test-Path -Path $newFile if($oldFilePresent -And $newFilePresent){ del $oldFile mv $newFile $oldFile } Get-ScheduledTask if($oldFilePresent){ $tasks = Get-ScheduledTask Get-ScheduledTask | out-file $new $comparison = compare-object (get-content $newFile) (get-content $oldFile) if($comparison){ $comparison | out-file C:\temp\tasksdiff.txt rmm-alert -Category "windows_tasks_changed" -Body "Windows Scheduled Tasks has changed! check out $(get-content C:\temp\tasksdiff.txt)" } } ELSE { Get-ScheduledTask | out-file $new mv $newFile $oldFile } |