Affected Builds
AppAssure 5.3.x and higher
Description
As repository sizes increase, repository check jobs have become time consuming operations. Moreover, on systems short on resources, the GUI may become very slow to respond or even unresponsive for a period of time.
Warning: AppAssure does not support PowerShell scripting. All scripts provided in this article are meant to be used as examples only. Click here for more information.
Solution
A simple PowerShell script which shows in real time the status of the repository check jobs has been prepared. When the checks are done, an e-mail alert is sent.
#RepoCheck.ps1
Write-host “`r`n`r`nRepository Check Survey`r`n_______________________`r`n<CTRL-C> to Exit`r`n”
Write-host “$(get-date)… Repository Check Survey Started” -f “Yellow”
#get cursor position
$saveY = [console]::CursorTop
$savex = [console]::CursorLeft
do{
#place cursor and write the update
[console]::setcursorposition($savex, $savey)
#get-jobs
$x = get-activejobs -all
#refine results
$x | where {$_.Summary -like “*repository*”} | select-object -expandproperty ChildJobsInfo | format-table Summary,Status,@{name=”Progress[%]“;expression={“{0:N2}%” -f($_.progress)}},@{name=”Rate[MB/s]“; expression={“{0:N02}MB/s” -f ($_.Rate)}} -wrap
#get end cursor position
#wait for a while
start-sleep 1
}
while ($x)
#exit the loop if job finished
#Make some room the easy way
write-host “`r`n`r`n`r`n`r`n`r`n`r`n`r`n`r`n`r`n`r`n`r`n`r`n`r`n`r`n`r`n`r`n`r`n`r`n`r`n`r`n`r`n`r`n`r`n`r`n`r`n`r`n”
write-host “Repository Check: finished at $(get-date)” -f “Yellow”
#Send e-mail alert
send-mailmessage -from “appassurecore@domain.com” -to “admin@domain.com” -subject “Repository Check Alert” -body “$(get-date)… Repository Check Status: finished” -smtpserver emailsvr.domain.com