You have a number of scheduled powershell tasks residing in Windows Task Scheduler. You want a quick was of checking them (and generating reports). You want to know when they have been run the last time, what was the result, when the next run time will be and number of missed runs.
WARNING: AppAssure does not support PowerShell scripting. All scripts used in this article are meant to be used as examples only. Click here for more information.
A power shell script has been prepared. The script assumes that you have complied with the practice of naming all your AppAssure related task with the AppAssure prefix (i.e. AppAssure_Daily_Suspend_Snapshot for a task that suspends all snapshots at a given time on a daily basis) and that is run on the core.
Please note that “Success” means that the task has been run successfully, not that the script which is the object of the task has been performed without errors.
Write-host “`r`n`r`nAppAssure Scheduled Tasks Report`r`n——————————–`r`n”
#check AppAssure Module
$aamodule=”appassurepowershellmodule”
if(-not (get-module -name $aamodule))
{ import-module $aamodule}
#logging option
$output = Read-host “`r`nEnter Report Path, default [c:\aaschd$((get-date).ToString("MM-dd-yyy_hh-mm-ss")).txt], [N] display only”
“`r`n”
if ($z1 -contains $output) {$display = $true}
else {$display = $false}
if ($output -eq “”) {$output = “c:\aaschd$((get-date).ToString(“”MM-dd-yyy_hh-mm-ss”")).txt”}
#Job headline on file
$k = “AppAssure Scheduled Jobs Report for $(get-date)`r`n”
if (-not $display){ $k > $output }
#get AppAssure tasks
$tasks = Get-ScheduledTask | Where {$_.taskname -like “*AppAssure*”}
#extract the results
foreach ($task in $tasks){
$t1 = “Task: $($task.taskname), Status:$($task.state)”
$t2 = $task| Get-ScheduledTaskInfo | Format-Table TaskName,LastRunTime, @{name=”LastTaskResult”; expression={if ($_.LastTaskResult -eq “0″){“Success”} elseif($_.LastTaskResult -eq “1″){“Never Ran”} else {“Failed”}}},NextRunTime,NumberofMissedRuns -wrap
#output to screen
Write-host -nonewline $t1 -f “Yellow”
$t2
#output to file; please note that more formatting is needed to avoid unnecessary new lines
if (-not $display)
{
$t1 += out-string -inputobject $t2
$t1 >> $output
}
}
© 2025 Quest Software Inc. ALL RIGHTS RESERVED. Terms of Use Privacy Cookie Preference Center