How To Write to SCOM Operations Manager Event Log Using PowerShell and MOM.ScriptAPI

Written by Tao Yang

The following commands can be executed using the normal PowerShell console. SCOM PowerShell snapin is not required.

$momapi = New-Object -comObject "MOM.ScriptAPI"

$momapi.LogScriptEvent("test",9999,2,"this is a test")

 

This is the log:

image

 

Detailed documentation of MOM.ScriptAPI can be found on MSDN.

Leave a Reply