Extending Windows Computer class from a SQL CMDB in SCOM

<!--[if lt IE 9]>


Comments (8)
  1. rob1974 says:

    CMDB (or whatever the source is) might change and that would require you to rewrite the mp. I create the extended windows computer class based on a registry value and I create scom task to set the registry key.

    An external script runs daily and reads from the source (CMDB, Excel, CSV, whatever). If there are new or changed properties the scom task(s) are called to set the registry with the new values. When the source changes all i need to do update the external script to grap its data from another source. And if for some reason the “source” is unavailable you can just manually set the keys.

  2. Sebastian says:

    Hi Kevin,

    thanks for this awesome article. I have built an automation process into SCOM based on the windows computer class extension based on your MP. After the class is extended and filled with our data from the CMDB there are some write actions which trigger PowerShell scripts by a schedule. For example one of the script creates SCOM groups based on the data from the CMDB and stores them into the same MP which contains the class extension and the write actions. Everything is stored into one unsealed MP. If you like some kind of self-updating MP.

    After importing the MP into SCOM everything works fine and the MP makes what it is designed for. 🙂 But after some time I have some errors in the “Operations Manager” Event Log:

    OpsMgr Management Configuration Service failed to execute ‘DeltaSynchronization’ engine work item due to the following exception
    Microsoft.EnterpriseManagement.ManagementConfiguration.Interop.ConfigManager.ConfigurationChangeException: Configuration change occurred during delta synchronization. Delta will be restarted.

    The Error occurs regularly until I remove the MP. So I can pretty sure say that the error comes from the MP.

    Now my Question:
    Have SCOM a problem with this self-changing MP? A MP that saves objects in itself.

    THX Sebastian

  3. Michael says:

    Hi Kevin,

    thank you very much for the Script. Maybe you can help me with an error i get when i execute your script.
    The line:
    $DiscoveryData = $momapi.CreateDiscoveryData(0, $SourceId, $ManagedEntityId)

    throws following error:
    Exception calling “CreateDiscoveryData” with “3” argument(s): “Invalid class string (Exception from HRESULT: 0x800401F3 (CO_E_CLASSSTRING))”
    At line:45 char:1
    + $DiscoveryData = $momapi.CreateDiscoveryData(0, $SourceId, $ManagedEntityId)
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ComMethodTargetInvocation

    and i can´t find why. You have any idea?

    Kind Regards,


    1. Michael says:

      We found the error,
      but in the next step the Data is not populated to the discovered object.

      1. Michael says:

        Hello Kevin,
        when i import the management pack into scom 2012r2 the discovery works fine now. Te discovery finds objects in a SharePoint view and in SCOM, also the compare works and shows the right count of systems. In the variables for FQDN, TIER…. the expected values are stored.
        But after the script ends without an error, i cant find the extends on the server objects in the SCOM console.
        Do you have any hint for me where to look or how i can fix the problem?

        Kind regards,

        1. Sebastian says:

          Hello Micheal,

          have you taken a look at the Discovered Invertory View at the Monitoring Pane. Choose your class extension and the values should be there.

          Hope it helps.

          Regards Sebastian

          1. Michael says:

            Hi Sebastian,
            i already did, but non of the matching servers come up.
            When i look under authoring -> management pack objects -> object discoveries i find the discovery that i had imported with the management pack. And in the discovery, i find the values i definite. So right now i don´t know exactly what my problem is.
            I pull my objects from the SharePoint…. checked
            With the object i get the values i to publish to the server objects in SCOM…. checked
            The script takes the server objects from SCOM and match it against the objects from SharePoint…. checked

            How can i find the error? Can i push the matching data into a file (Excel/csv) to check if the mapping and variables work?

            Thank you,


            1. Sebastian Pabst says:

              Hi Michael,

              maybe you have your problem solved but in the case that not:

              Have you checked the eventlog of your Management Server? Kevin have implemented logging into the Operations Manager Log at the SCOM Management Server.

              This is the interesting line (EventID 8888):
              $momapi.LogScriptEvent($ScriptName,$EventID,0,”`n CMDB returned ($CMDBRowCount) computers. `n SCOM returned ($HSCount) Computers. `n Discovery returned ($CMDBMatchComputerCount) matching computers from the CMDB and SCOM.”)

              The $CMDBMatchComputerCount variable should give you a number of Systems which will be inserted into you Class Extention.

              You can also try to use this logging PowerShell method to write out every system to the log. You should use the $FQDN variable for that. In this case you can see which system pass the PS script and is writen to the SCOM Property Bag.

              Regards Sebastian

Comments are closed.

Skip to main content