-
Notifications
You must be signed in to change notification settings - Fork 28
2023 demo H Adding to Groups
Chris Lasell edited this page Aug 24, 2023
·
1 revision
-
Now we can add the computers we just created to the static group we just created
-
There are a couple of ways to add and remove members from static groups:
- Add them individually by name or id to our local instance, then save the group back to the JSS
- We'll do that later in a script.
- Use the
change_membershipmethod- It uses the ability of the API to add and remove static group members directly and immediately
- It doesn't require a
saveafter making the changes
- Add them individually by name or id to our local instance, then save the group back to the JSS
-
Here's how to use
change_membership:
my_grp.change_membership add_members: new_comp_ids
# => array of member data-
The
add_members:parameter takes an array of any kind of identifiers; ids, names, serialnumbers, udids, etc- We already have an array of the ids of our computers:
new_comp_ids
- We already have an array of the ids of our computers:
-
The changes are immediately applied to the JSS
-
You can also provide a
remove_members:parameter to add and remove at the same time -
You will get an error if you try to add something that doesn't exist in the JSS