2 Replies Latest reply on Mar 16, 2015 10:12 AM by datwiddler

    Powershell SDK - add custom properties to a group

    datwiddler

      Fairly new to powershell and NPM,

       

      We are running NPM 11.5, Just upgraded from 11.0.1 and SDK 1.10.16

       

      Since the addition of custom fields being added to groups, does anyone have examples of how to add custom properties using powershell?

        • Re: Powershell SDK - add custom properties to a group
          Jan Pelousek

          Hello, to edit the group Custom property you need to know the group uri and to edit the value specify the "/CustomProperties" in addition.

           

          Let's say I created group Custom property, called "grcp", the update statement will look like:

          $grCPUri = ((get-swisdata $swis "select top 1 uri from orion.groups") + "/CustomProperties")
          Set-SwisObject $swis -Uri $grCPUri -Properties @{grcp='sadf2'}
          

           

          to create the new one use the verb "CreateCustomProperty" from the Orion.GroupCustomProperties entity.

          Example with some dummy values:

          Invoke-SwisVerb $swis "Orion.GroupCustomProperties" "CreateCustomProperty" @('GroupCP2','DescrCP1', 'memo', '20', '', 'bps', 'Header', 'left', 'bps', 'bps') | Out-Null
          

           

          I hope it helps.

          Honza