This script sets the resolution state in SCOM using the SCOM REST API (version 1801 or newer).
The final Invoke-WebRequest (setting the resolution state) is supposed to end with http status 200 (OK).

Basically, this could be used as an example for other requirements.

Find the API reference here: https://docs.microsoft.com/en-us/rest/api/operationsmanager

 

CONFIGURATION
It is possible to define multiple SCOM web servers directly in the script or pass a web server using the parameter.
In order to reset monitors there is a notification channel solution here: https://gallery.technet.microsoft.com/systemcenter/PoSh-Reset-Monitor-On-c288374a?redir=0
  
PARAMETER alertId
Mandatory.
The alertID(s) supposed to be updated.
PARAMETER comment
Optionally.
The comment which should be written to the alerts comment field. Default = "Incident has been resolved in SNOW"
PARAMETER resolutionstate
Optionally.
The resolution state which should be set. Default = 255 (= Closed)
Monitors will be reseted by a notification channel (see configuration chapter above).
PARAMETER scomWS
Optionally.
The FQDN of the web server. Could be hard-coded in the script either.
PARAMETER scomUsername
Optionally.
PARAMETER scomPassword
Optionally.
If not provided the script will use the current users name and password
EXAMPLE 1 (Default)
.\Set-RestApiResolutionState.ps1 -alertId 907c16f1-f54f-44ab-9a4a-a1a1ce795154
200
OK
EXAMPLE 2
.\Set-RestApiResolutionState.ps1 -alertId 907c16f1-f54f-44ab-9a4a-a1a1ce795154 -comment "Hello World" -resolutionstate 250 -scomWS server.fqdn.com -scomUsername domain\username -scomPassword password
200
OK