python 3 script to put users into static group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
02-01-2021
09:56 AM
- last edited on
03-04-2025
02:54 AM
by
kh-richa_mig
I work 99% in bash, so thats my main language, but currently Im working with python as thats whats working with OKTA.
Currently I get a list of all user status from OKTA, which i need to then compare against and see if there are any overlapping names from JSS.
For any overlap, i need their user id and ALL the computer IDs so that i can put them into specific static groups.
I have this working in shell (without OKTA) but my brain is struggling with python/json and how to work the language.
hoping someone has some insight.
I have simplified the workflow thanks to "import jamf" and "pprint" but so far i have been only able to get a list of all users with their ID and computers with their ID, but its too generic for the workflow.
Ideally it would work like this:
- get list of all OKTA user's and their status
- put into list/array all OKTA users with deprovionsed status
- get list of all JSS users (full data, which i think i can do with a for loop but i havent been succesful with it), where its for each user in (all jss users), get user ID and all computer IDs
- in that same for loop, see if the user is in array of deprovisioned users
- if they match, add the user ID to static group, and run another for loop to add the computer(s) to the static groups.
- Labels:
-
Scripts
