Creates a new property bag object, which is used to temporarily store operations data (such as discovery, event, or performance data) as a collection of name-value pairs.
MOMScriptAPI.CreatePropertyBag() |
Return Value
Type | Description |
---|---|
Object |
A new instance of the MOMPropertyBag object. |
Remarks
A script uses a property bag to store output data that will be used by subsequent modules. Three possible uses of property bags are:
- Map data to a performance point and store in the
database.
- Map data to an event and store in the database.
- Use data to evaluate state as part of a monitor.
Requirements
Platforms: Requires Windows Server 2003, Windows Vista, or Windows Server 2008
Version: Requires Operations Manager 2007
Example
This example creates a property bag and adds a name-value pair by using the target computer and the time to ping that computer. A single script can create a single property bag. However, within the property bag any number of name-value pairs can be created.
Copy Code | |
---|---|
Option Explicit Dim oArgs Set oArgs = WScript.Arguments Dim oAPI Set oAPI = CreateObject("MOM.ScriptAPI") ' Ping the target computer. Dim targetComputer ' targetComputer is the Fully Qualified Domain Name ' of the computer targeted by the script. The FQDN ' is within Arg(0) of the command prompt. targetComputer = oArgs(0) Dim objPing, objStatus, timeToPing, computername Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}")._ ExecQuery("Select * From Win32_PingStatus where address = '"_ & targetComputer & "'") For Each objStatus in objPing timeToPing = objStatus.ResponseTime computername = objStatus.Address Next ' ' Create a MOM Property bag and add the target computer with ' the ping time as a value pair. Dim oMOMBag Set oMOMBag = oAPI.CreatePropertyBag() Call oMOMBag.AddValue(targetComputer, timeToPing) ' Submit the computer name and ping response time ' as performance data to the Operations Manager database. Call oAPI.Return(oMOMBag) |
See Also
Send comments about this topic to Microsoft.