The following PowerShell script will run an attachability check on all the recovery points for a specified server with a yellow status. Replace "Agent-Name" with the name of your SQL agent name for which you want to run attachability checks. You can use Windows Task Scheduler to run this script daily or even more frequently. You also may need to increase the amount of time that this script is going to wait between each check as 10 seconds may be to quick and checks will skip.
NOTE: Before using this script, please view Quest support of PowerShell scripting for AppAssure policy, located here.
-----------------------------------------------------------------------------
$AgentName = Agent-Name
import-module appassurepowershellmodule
# Get the recovery points for this agent that have a yellow status
$RPs = get-recoverypoints -protectedserver $AgentName |where State -Contains 'Yellow'
#The following line may have to be used instead because the line above will only look at recovery points created today and if you have recovery points from other days that also need to be checked this line will have to be used instead. $RPs = get-recoverypoints -protectedserver $AgentName -number all | where State -Contains 'Yelow'
$Numbers = @($RPs.number)
# Force an attachability check for each of the recovery points with a yellow status, waiting 10 seconds between each check
$i=0
for ($i=0; $i -lt $Numbers.count; $i++)
{
C:\"Program Files"\AppRecovery\Core\CoreService\aacmd /forceattach -protectedserver $AgentName -rpn $Numbers[$i]
start-sleep -s 10
}
-----------------------------------------------------------------------------