How to perform TakeRecommendedAction for Get-DPMAlert RRS feed

  • Question

  • I'm trying to invoke the method "RecommendedAction" correctly to programmatically have DPM perform the recommended action when there is an Alert such as "Replica is inconsistent" or "Recovery Point failure".  How do I invoke this correctly?  I have the following coded:

    $DPMServer = hostname

    Connect-DPMServer $DPMserver

    $Alerts = get-DPMAlert -dpmservername $DPMServer -IncludeAlerts allactive | where-object {$_.severity -eq 'error'}

    $Alerts | ForEach {


    Why does the statement in Bold fail?  Thank you so much for your help.

    - Jenna

    Friday, January 16, 2015 10:20 PM

All replies

  • Could anyone point me to an example of how to use "TakeRecommendedAction" with Get-DPMAlert?

    Desperate for help ;-(.

    Saturday, January 17, 2015 10:03 PM
  • Hi,

    Maybe there is no RecommendedAction?

    Please post us the Error

    i am using it this way

    foreach ($Alert in $Alerts) 

    Seidl Michael | | | |

    Tuesday, January 20, 2015 7:29 AM
  • I'm running DPM 2012 R2 and the error returned is:

    Exception calling "TakeRecommendedAction" with "0" argument(s): "The method or operation is not implemented."
    At line:1 char:29
    + foreach ($Alert in $alerts){$alert.takeRecommendedAction()}
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : NotImplementedException

    Thursday, January 22, 2015 3:57 PM
  • please post your affected Error, think there is no "Recommended Action" for this alert

    Seidl Michael | | | |

    Sunday, January 25, 2015 9:08 AM
  • The TakeRecommendedAction method requires the parameter of the type Microsoft.Internal.EnterpriseStorage.Dls.EngineUICommon.AdhocJobsContext. Below example of the code to take the recommended action:

    foreach ($oAlert in (Get-DPMAlert | Where-Object -FilterScript {$_.Resolution -eq [Microsoft.Internal.EnterpriseStorage.Dls.Utils.Alert.AlertResolution]::VisibleAndActive})) {
    	$oResult = $oAlert.TakeRecommendedAction($oAlert.GetAdhocJobsContext());
    	# Optional loop to wait for the action be finished before processing the next alert
    	Start-Sleep -Seconds 10;
    	While ($oResult.Status -eq "InProgress") {
    		Start-Sleep -Seconds 10;
    I haven't tested the script this way with the filter, but it should get all active alerts which have a recommended action.

    • Proposed as answer by Skolvikings80 Wednesday, April 4, 2018 3:30 PM
    Friday, February 13, 2015 9:44 AM
  • I got mine working with this:

    $dpmAlerts = @(Get-DPMAlert -DPMServerName $Env:Computername)
    if ($dpmAlerts)
        foreach ($d in $dpmAlerts)

    Wednesday, April 4, 2018 3:31 PM