Scripting Tip: Valid Event ID ranges when using the MOMScriptAPI.LogScriptEvent method

I was working with a custom runtime script the other day and received an ambiguous error message when I executed the script on my development workstation.

Error: Microsoft VBScript runtime error: Subscript out of range

Issue: The Event ID I was using was actually an invalid event number!

Workaround: The .LogScriptEvent method only accepts event IDs from 1 to 20000. 20001 and higher result in the error above.

Additional Reading

Incidentally, if you’re developing custom runtime scripts for Operations? Manager and Essentials 2007 check out our Scripting Series, which includes several articles on writing monitoring scripts for OpsMgr. (I still need to put a discovery scripting sample together). Search the site for “Scripting Series” which should reveal all the posts and related downloads.

Leave a Reply

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