MOMScriptAPI other undocumented methods


With my last post, I started to look at undocumented methods of MOMScriptAPI. These methods are published thru IDL file (interface definition language) as well are visible using tools like oleview.exe. Now I will try to document those APIs so they can be used whenever MOMScriptAPI object can be used ….


First I should mention that MOMScriptAPI is definitely able to produce batch of data items created within. That means that simple script is able to provide multiple property bags or discovery data items. Following is definition of APIs currently missing from MSDN:


 



MOMScriptAPI.AddItem(dataItem)


This method adds a new property bag object (used to “temporarily” store operations data (such as event, performance data, or any other data) as a collection of name-value pairs) or new discovery data type into in-memory array of objects created inside of the same script. It is not allowed to mix data types added into this container. This means that one MUST not mix property bags (created by CreateTypedPropertyBag or CreatePropertyBag) with discovery (created by CreateDiscoveryData). If such combination is used, module fails to produce output and ultimately causes rule using this script to fail and unload.


Parameters












Parameter


Type


Description


dataItem


object


Discovery data item or property bag (see above).



Return Value


None




MOMScriptAPI.ReturnItems()


This method submits data items created within script back to Management Server and ends the execution of the script. Data items which are being added and later submitted must be of same type following restrictions described in AddItem API. Calling this method without adding items into in-memory container causes workflow using this script to fail and unload as well.


Parameters


None



Return Value


None 


Remarks


We now know that script creates a data item(s) which will be used by subsequent modules. It is also possible to execute script used as a part of rule outside of the Operations Manager. It creates XML string that can be displayed in a console window. For possible example of the use of described APIs, please see my previous post

Skip to main content