Advertisement
Creops

Puts a computer in a group based on serial

Mar 28th, 2019
414
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.79 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. #JAMF: Puts a computer in a group based on serial.
  4.  
  5. # ——————————— API Info ———————————
  6. apiuser="user"
  7. apipass='password'
  8. jamfProURL="https://jamf.server.com"
  9. GroupID="1024"
  10.  
  11. # ——————————— Getting the serial ———————————
  12. computerserial="$(system_profiler SPHardwareDataType | grep 'Serial Number (system)' | awk '{print $NF}')"
  13.  
  14. # ——————————— Things that gets done ———————————
  15. curl -k "$jamfProURL/JSSResource/computergroups/id/$GroupID" --user "$apiuser:$apipass" -H "Content-Type: application/xml" -X PUT -d "<computer_group><computer_additions><computer><serial_number>$computerserial</serial_number></computer></computer_additions></computer_group>"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement