Skip to main content
Jamf Nation, hosted by Jamf, is a knowledgeable community of Apple-focused admins and Jamf users. Join us in person at the ninth annual Jamf Nation User Conference (JNUC) this November for three days of learning, laughter and IT love.

Bulk Edit Static User Groups

Looking to have an easy way to bulk edit members of a static user group. I had a user group with 200+ members that I needed to remove and add new members. Rather than scrolling through and unchecking, would be nice to be able to check all or uncheck all to remove the users rather than delete the group and recreate it with new members.

Order by:

Posted: by cdenesha

I've been using a Mac app that leverages the API, called The MUT.

I view the static user group and export, and clean up the CSV in Excel. I add the Static Group ID in column 2 and then I use that with The MUT's ability to REMOVE from a user static group.

For new users you'll need to have a list of usernames that you can put in a CSV so you can ADD to the static group.



Posted: by strayer

I've set up a self service policy to add a computer to/remove a user from a group utilizing the jamf API. One of the things on my to do list is to make a script to bulk add/remove users to a static group.

My basic plan is to make a python script to read a CSV for computer names and then use the API to remove all of the users.


Posted: by strayer

Okay so 2 files in the same directory, a python file (python 3):


import os
import csv
import sys
import re
#import urllib2
from urllib.request import urlopen
import subprocess
import shutil
from getpass import getpass

## can be 'additions' 'deletions' or None if none it will prompt you
action = None
## can be static group ex. 918 number or None if None it will prompt you.
group = None


## designed to be entered into command line as: 
## python3 /Path/To/Group.csv jamfUsername jamfPassword
## It willl prompt for jamf username or password if not entered into command

if len(sys.argv) >= 2:
    csv_file = sys.argv[1]
    print('Please enter the name of the csv file in sys argv 1')

if len(sys.argv) >= 4:
    api_user = sys.argv[2]
    api_pass = sys.argv[3]
    api_user = input("enter your Jamf Username: ")
    api_pass = getpass("enter your Jamf Password: ")

if len(sys.argv) >= 5:
    if sys.argv[4] == 'additions' or sys.argv[4] == 'deletions':
        action = sys.argv[4]

while action != 'additions' and action != 'deletions':
    action = input("enter 'additions' or 'deletions': ")

if group == None:
    group = int(input("Enter the group number: "))

fullURL = "{}/JSSResource/computergroups/id/{}".format(jamfURL, group)

def csv_dict_list(file):
    # Open variable-based csv, iterate over the rows and map values to a list of dictionaries containing key/value pairs
    reader = csv.DictReader(open(file, 'r'))
    dict_list = []
    for line in reader:
    return dict_list, reader

def create_xml(computer_name, action=action):
    xml = "<computer_group><computer_{}><computer><name>{}</name></computer></computer_{}></computer_group>".format(action, computer_name, action)
    return xml

def complete_computer(dict, action=action):
    computer_name = dict['Computer Name']
    xml = create_xml(computer_name)
    result =['./', '{}'.format(fullURL), '{}'.format(api_user), '{}'.format(api_pass), '{}'.format(xml) ])

if __name__ == '__main__':
    dict_list, reader = csv_dict_list(csv_file)
    for dict in dict_list:

another file in the same directory named ""

#! /bin/bash


curl "$fullURL" -u "$APIUser:$APIPass" -H "Content-Type: text/xml" -X PUT -d "$xml"

you may need to change the permissions on the using chmod 755

At that point you can take a CSV with the field of "Computer Name" (jamf exports groups as this) and it should add or delete them as needed.