PowerShell - SCOM PropertyBag, How to check if value already added? RRS feed

  • Question

  • I want to add values to a PropertyBag.

    How is it possible to check if the value is already in the PropertyBag?

    I know one can use an array, list, etc. But how can I use the $bag/$api object to do this check?

    $api = New-Object -comObject “MOM.ScriptAPI”
    $bag = $api.CreatePropertyBag()

    I'm searching for something like this:

    if($bag -match "TestValue1")

    {"In the Bag!"}

     But, unfortunately, it's not working.


    • Edited by LaPhi Wednesday, November 16, 2011 11:00 AM
    Wednesday, November 16, 2011 10:28 AM