Adding a powershell script in SCOM as a recovery task.
Open the properties of the monitor.
Add the recovery task
Export the management pack and open it in any text editor. You have to change the write action to powershell write action. Locate the enrty for write action and replace it with a powershell write action ID.
Replace
TypeID="Windows!Microsoft.Windows.ScriptWriteAction"
with
TypeID="Windows!Microsoft.Windows.PowerShellWriteAction"
Remove the <Arguments /> section.
Increment the version and import the management pack.
Open the properties of the monitor.
Add the recovery task
Export the management pack and open it in any text editor. You have to change the write action to powershell write action. Locate the enrty for write action and replace it with a powershell write action ID.
Replace
TypeID="Windows!Microsoft.Windows.ScriptWriteAction"
with
TypeID="Windows!Microsoft.Windows.PowerShellWriteAction"
Remove the <Arguments /> section.
Increment the version and import the management pack.