5 Replies Latest reply on Jun 24, 2015 8:46 AM by tdanner

    modification of custom properties is not working consistently

    dkeyser

      Hello all,

       

      Another issue I've run into that has me baffled. I'm setting a custom property to indicate that a node has been added via the SDK and it's just not working. This used to work but now it's complaining that the CP doesn't exist when it does. Also in another area I'm allowing users to input nodes via CSV and they can specify a list of CPs and their values to set. This is not complaining at all but again does nothing to the Node CPs. Anyone else having this issue? Any ideas as to why this would happen? Code below:

       

       

       

      #setting value to custom property named ImportedFromScript that is True or False. 0 = False 1 = True.

      $CustomPropBag = @{

      ImportedFromScript = 1;

      }

       

       

      Set-SwisObject $swis -Uri $newNodeUri -Properties $CustomPropBag

       

       

       

       

       

      #Setting Custom Properties from CSV import

      function AddCustomProperties ($customPropertiesTargets, $customPropertiesValues, $NewNodeID)

      {

          $CPNodeID = $NewNodeID.getvalue(3)

       

       

          $CPNodeUri = "swis://WIN-52UF450J3UO./Orion/Orion.Nodes/NodeID=$CPNodeID/CustomProperties"

       

       

          $CPTargetCount = $customPropertiesTargets.Count

          $CPIndex = 0

       

       

      while ($CPTargetCount -gt $CPIndex)

      {

          $Name = $customPropertiesTargets[$CPIndex].tostring()

          $Value = $customPropertiesValues[$CPIndex].ToString()

          $CustomPropBagCP = @{

          $Name = "$Value"

          }

          Set-SwisObject $swis -Uri $CPNodeUri -Properties $CustomPropBagCP

          $CPindex = $CPindex + 1

      }

       

       

       

       

      }