08-26-2023 03:31 AM - edited 08-26-2023 03:53 AM
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.
Posted on 08-26-2023 05:17 AM
You may want to use The MUT found in the Mac App Store. Requires no scripting knowledge.
Posted on 08-26-2023 05:17 AM
You may want to use The MUT found in the Mac App Store. Requires no scripting knowledge.
Posted on 09-08-2023 09:46 AM
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.
Posted on 08-28-2023 03:34 PM
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:
#!/usr/bin/env ruby
require 'ruby-jss'
require 'csv'
# 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
Jamf.connect 'https://apiuser@myjamfhost.jamfcloud.com'
# 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
static_group.save
Five lines of code, not counting the shebang and 'require' lines.