As the number of protected servers increase, rollups become a very sensitive issue. The rollup jobs may take many hours or even days to complete. Moreover, there is a good chance that, in the case of systems short on resources, the GUI becomes slow to update or even unresponsive for periods of time.
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.
The script focuses on the current rollup job, showing some key indicators and keeps a summary of completed, pending and errored jobs.
When the rollups is finished an alert e-mail is sent (please update the values in the last lane).
#get cursor position
“`r`nCurent Rollup Job`r`n____________________`r`nHit CTRL-C to exit`r`n”
#change this value for the refresh frequency [default 5 sec]
$timeslice = 5
#import Powershell Module if it is not present
if ((get-module -name appassurepowershellmodule) -eq $null){ import-module appassurepowershellmodule}
#get the rollup job
$rollupjob = get-activejobs -all | where {$_.summary -like “*roll*”}
#Prepare and show the start time and total job size
$start = $rollupjob | select-object -expandproperty starttime
$work = $rollupjob | select-object -expandproperty totalwork
Write-host (“Job Started on $($start) with a total work of {0:N2}GB” -f ($work/1GB))
#get & Save cursor position
$saveY = [console]::CursorTop
$savex = [console]::CursorLeft
#do the job!
do
{
#prepare & display current summary of the job
[int]$succ = 0
[int]$err=0
[int]$pend=0
[int]$running
#place cursor and write the update
$R = get-activejobs -all | where {$_.summary -like “*roll*”} | select-object -expandproperty childjobsinfo
foreach($machine in $R){
if($machine.status -eq “Succeeded”) {$succ++}
if($machine.status -eq “Pending”) {$pend++}
if($machine.status -like “*Err*”) {$err++}
if($machine.status -eq “Running”) {$running++}
}
Write-host “Total: $($R.count) machines, $($succ) suceeded, $($pend) pending, $($err) errored, $($running) running” -f “Yellow”
#Prepare and display current job
$x = $R| where {$_.status -eq “Running”}
$x | ft Summary,Phase,@{name=”Remaining”;expression={“{0:N2}GB” -f (($_.TotalWork – $_.Progress)/1GB)}},@{name=”Speed”;e={“{0:N2}MB/s” -f($_.Rate/1MB)}} -wrap
start-sleep $timeslice
#place cursor and write the update
[console]::setcursorposition($savex, $savey)
}
while ($x)
#send e-mail alert
send-mailmessage -from “appassurecore@domain.com” -to “admin@domain.com” -subject “Rollup Job Finished” -body “$(get-date)… Rollup Job Status: finished” -smtpserver emailsvr.domain.
© ALL RIGHTS RESERVED. Feedback Terms of Use Privacy Cookie Preference Center