locked
Testing discovery script in Powershell gives error on $api.CreateDiscoveryData(0, $sourceId, $managedEntityId) RRS feed

  • Question

  • Hello,

    I'm currently starting to develop management packs for SCOM, i understand the basics and can build a simple management pack using powershell.

    During testing i'm running into a problem, when running the powershell script directly it gives an error. If i use the discovery script in a management pack everything works ok.

    The error is:

    Exception calling "CreateDiscoveryData" with "3" argument(s): "Ongeldige klassereeks (Exception from HRESULT: 0x800401F3 (CO_E_CLASSSTRING))"

    Part of it is in dutch but it means something like invalid class.

    I tried to run the script on one of our management servers but it also gives this error.

    It's very frustrating because i want to test the discovery scripts first before building the complete management pack.

    Thanks for your help!

    Wednesday, March 25, 2015 3:06 PM

Answers

  • Something along these lines should work for you:

    .\DiscoveryTest.ps1 -sourceID ([guid]::NewGuid().ToString("B")) -managedEntityID ([guid]::NewGuid().ToString("B"))

    Of course your parameter names and numbers may differ.


    It would be greatly appreciated if you would mark any helpful entries as helpful and if the entry answers your question, please mark it with the Answer link.

    Wednesday, March 25, 2015 7:06 PM

All replies

  • Something along these lines should work for you:

    .\DiscoveryTest.ps1 -sourceID ([guid]::NewGuid().ToString("B")) -managedEntityID ([guid]::NewGuid().ToString("B"))

    Of course your parameter names and numbers may differ.


    It would be greatly appreciated if you would mark any helpful entries as helpful and if the entry answers your question, please mark it with the Answer link.

    Wednesday, March 25, 2015 7:06 PM
  • Thanks that worked perfectly!
    Thursday, March 26, 2015 6:44 AM