OpsMgr: Prevent warning event 21405

A System Center Operation Manager (SCOM or OpsMgr) management pack might cause warning event with ID 21405. This event is raised when a script is run without returning any data.


Log Name:      Operations Manager
Source:        Health Service Modules
Date:          16-3-2012 16:14:26
Event ID:      21405
Task Category: None
Level:         Warning
Keywords:      Classic
User:          N/A
The process started at 16:14:26 failed to create System.PropertyBagData, no errors detected in the output.  The process exited with 0

A script is run to discover objects or to query data (to collect data – a rule – or to monitor and object – a monitor) and should return this data to the MOM.ScriptAPI object so it can be processed. If a script is run without returning data OpsMgr suspects an issue. A script might not return data because of antivirus, DEP or by design. If you design a management pack, continue reading.

By design

If you expect a script not to return data you need to make sure that OpsMgr is aware of this so you can prevent the 21405 event. The event can be prevented by adding an event policy, as described by Raphael Burri:

First of all you need to make sure the script ends gracefully (error code 0)


Secondly you need to add an event policy at the end of the datasource tag.

   <!--Do not write Warning Event 21405 (no discovery data) when the script doesn't return any data (product not installed) –>
   <!--Standard Error Out Matches (leave default) –>
   <!--Exit Code matches (leave default) –>



If you have a script that is used to discover objects and it fails to complete successfully, there is a chance that the objects disappear from OpsMgr. To avoid this you can set the IsSnapshot property of the CreateDiscoveryData to True, as described by Boris Yanushpolsky.


Error opening management pack

The first time I tried adding the event policy, as described by Raphael Burri, I got the following error while opening the file in the Authoring Console:


Date: 3/16/2012 8:20:30 PM
Application: System Center Operations Manager 2007 R2 Authoring Console
Application Version: 6.1.7221.49
Severity: Error

: XSD verification failed for management pack. [Line: 135, Position: 18]
The element 'DataSourceModuleType' has invalid child element 'EventPolicy'. List of possible elements expected: 'Configuration'.
System.Xml.Schema.XmlSchemaValidationException: The element 'DataSourceModuleType' has invalid child element 'EventPolicy'. List of possible elements expected: 'Configuration'.

This is because the EventPolicy element isn’t defined properly.


Example: TimedScript.PerformanceProvider

I’ve got a rule that collect performance data using the Microsoft.Windows.TimedScript.PerformanceProvider data source module. I know that the object I’m querying not always return data because it only generates data at certain moment, so I don’t want to return a PropertyBag.

Before you can add the event policy to a datasource you need to include the CommandExecuterSchema schema and add a EventPolicy element to the DataSourceModule.

<DataSourceModuleType ID="Denamik.E2EM.DataSource.Entity" Accessibility="Internal" Batching="false">
      <xsd:element minOccurs="1" name="IntervalSeconds" type="xsd:integer" />
      <xsd:element minOccurs="1" name="TimeoutSeconds" type="xsd:integer" />
      <xsd:element minOccurs="0" maxOccurs="1" name="EventPolicy" type="CommandExecuterEventPolicyType" />

Now you can add the event policy to the datasource:

   <DataSource ID="DS" TypeID="Windows!Microsoft.Windows.TimedScript.PerformanceProvider">
      <SyncTime />
      <ScriptName>(your script name)</ScriptName>
      <ScriptBody>(your script)</ScriptBody>
         <StdOutMatches />

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *

Deze site gebruikt Akismet om spam te verminderen. Bekijk hoe je reactie-gegevens worden verwerkt.