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
It is possible to define multiple SCOM web servers directly in the script or pass a web server using the parameter.
The alertID(s) supposed to be updated.
The comment which should be written to the alerts comment field. Default = "Incident has been resolved in SNOW"
The resolution state which should be set. Default = 255 (= Closed)
Monitors will be reseted by a notification channel (see configuration chapter above).
The FQDN of the web server. Could be hard-coded in the script either.
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
.\Set-RestApiResolutionState.ps1 -alertId 907c16f1-f54f-44ab-9a4a-a1a1ce795154 -comment "Hello World" -resolutionstate 250 -scomWS server.fqdn.com -scomUsername domain\username -scomPassword password