This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Powershell SDK - add custom properties to a group

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?

  • 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

  • Jan,

    I had been trying something similar and after you posted this morning I realized I was missing the "/CustomProperties" from the uri string.

    Thank you for your help, really appreciated.