Home » Scripts » Update resolution state with a script


Welcome to contoso.se! My name is Anders Bengtsson and this is my blog about Azure infrastructure and system management. I am a senior engineer in the FastTrack for Azure team, part of Azure Engineering, at Microsoft.  Contoso.se has two main purposes, first as a platform to share information with the community and the second as a notebook for myself.

Everything you read here is my own personal opinion and any code is provided "AS-IS" with no warranties.

Anders Bengtsson

MVP awarded 2007,2008,2009,2010

My Books
Service Manager Unleashed
Service Manager Unleashed
Orchestrator Unleashed
Orchestrator 2012 Unleashed
Inside the Microsoft Operations Management Suite

Update resolution state with a script

This is a script you can use to update resolution state. It will look at all new alerts (resolutionstate = 0) and see if the alert description contains “domain” or “AD”, if they do, the script will set a new resolution state. The ID for the resolution state can be found under alert settings in the administration workspace, in the Operations Manager console. You can schedule task to run this script every X minute to update all new alerts.

$RMS = “myRMSHost”

Add-PSSnapin “Microsoft.EnterpriseManagement.OperationsManager.Client”
Set-Location “OperationsManagerMonitoring::”
New-ManagementGroupConnection -ConnectionString:$RMS
Set-Location $RMS

$resState = 42 
$alerts = get-alert -criteria ‘ResolutionState =”0″‘ | where-object {($_.Description -match “AD”) -or ($_.Description -match “domain”)}
If ($alerts)  {
   foreach ($alert in $alerts)
    $alert.ResolutionState = $resState

The schedule task command can be

C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -command C:\myscripts\change_resolutionstate.ps1


  1. Yes, as it is running PowerShell it should be enable to connect to the management group from any machine. You can also do this with Opalis if you have it around.

  2. Hi Anders, I use your script expanded with the possibility to read different alert desrcriptions from a file. This script consume a lot of CPU at the RMS. Is it possible to run it from a MS?

    TX in Advance

  3. Good post, but are you only sorting by “AD” og “domain”?

    I am using the following script:

    param ($rootMS)

    #Initializing the Ops Mgr 2007 Powershell provider
    add-pssnapin “Microsoft.EnterpriseManagement.OperationsManager.Client” -ErrorVariable errSnapin ;
    set-location “OperationsManagerMonitoring::” -ErrorVariable errSnapin ;
    new-managementGroupConnection -ConnectionString:$rootMS -ErrorVariable errSnapin ;
    set-location $rootMS -ErrorVariable errSnapin ;

    $Alerts = get-alert -criteria ‘Name = ”Script or Executable Failed to run”’ | Where {$_.ResolutionState -eq 0}
    foreach($Alert in $Alerts)
    {$Alert.ResolutionState = 29
    $Alert.Update(“Resolution State Changed”)}

    And then this command:
    Powershell D:\ChangeResolutionState\SCOM\ScriptorExecutableFailedtorun.ps1 -rootMS MYRMS.domain

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.