Automatically resolving alerts… such as resume ownership… - System Center: Data Protection Manager Engineering Team Blog - Site Home - TechNet Blogs

Automatically resolving alerts… such as resume ownership…

Automatically resolving alerts… such as resume ownership…

  • Comments 1
  • Likes

Alerts are not generated to be dismissed without evaluation and some resolve automatically but there are moments when automatic handling of alerts is appreciated. More often than not alerts are predictably handled the same anyway, namely using the “recommended action” link.

Some management activities are handled through the alert mechanism, like reclaiming ownership of agents after switch back from a prior switched protection. In this case, most likely you want to reclaim ownership of all protected servers and can be many.

By courtesy of Vinay Tibrewal from the DPM team the script below automatically takes the recommended action and resolves the active alert for all protected servers. The $alert.Servername property can be used to filter on machine names if desired.
This can also be seen as a sample framework to handle alerts from a script.  If further interested , the last part of the script retrieves and displays all possible alert types, currently there are some 64 alert types.

#begin script

$dpmServer = Connect-DPMServer -DPMServerName $dpmServerName $dpmServer.AlertController.RefreshAlerts()
$ownershipAlerts = @($dpmServer.AlertController.ActiveAlerts.Values | Where {$_.Type.ToString() -eq "AgentOwnershipRequiredAlert"} )

if ($ownershipAlerts){
  
foreach ($alert in $ownershipAlerts) {
       $alert.TakeRecommendedAction()
      
$alert.ResolveAlert()
  
}
}

$evals=[enum]::GetValues([microsoft.Internal.EnterpriseStorage.Dls.Utils.AlertTypes.AlertEnum])
write-host “Alert types are;”
$evals

#end script

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • This works great. I want to output the alerts to a log file which i'm using the following within the foreach statement

    $alert.AffectedArea + "," + $alert.errorinfo.shortproblem + "," + $alert.OccurredSince + "," + $alert.errorinfo.resolution | out-file $LogFile -confirm:$false

    However when running from DOS so i can set it up as a schedukled task the output is blank.

    powershell -psconsolefile "F:\DPM\DPM\bin\dpmshell.psc1" -command "& {C:\DPMAlerts.ps1}"

    Is there a limitation of DOS at parsing the data out of DPM when calling the PS script?