I am new to Jamf Pro API and I am diving into more and more automations.
Can someone help me with how i would go about to updating multiple computer assignments for a static group by using computer names. If you have a working script, please assist. maybe via csv file?
Solved! Go to Solution.
Been using MUT for a few years now, very happy with it, though I always get the "need to use classic method" verbiage and if I want to run it that way and I always say yes.
Kinda wish, I could make that the default, but either way, great program.
If you still want a scripted solution, and you are familiar with, or willing to use, ruby as your programming language, ruby-jss makes doing things like this very easy:
# This csv file contains the computers that should be in the group
# Computer names are in the first field of this csv file.
# Get the names into an array
desired_comp_names = CSV.read('/path/to/computernames.csv').map(&:first)
# connect to Jamf Pro
# you'll be prompted for the password, or it can be given with the 'connect' command
# get the group by name
static_group = Jamf::ComputerGroup.fetch name: 'StaticGroupName'
# replace any existing membership with the desired names
static_group.members = desired_comp_names
# save your changes
Five lines of code, not counting the shebang and 'require' lines.