Posted on 09-06-2016 09:09 AM
I'm trying to automate more of my imaging workflow/AD maintenance and this would be really helpful if it's possible.
I know it should be possible to pull a value for a machine's extension attribute using the API, but I don't really know how to achieve it. The EA is called "Client Room" and I'd like to pull that value then write it to the device's description field in AD if that's possible. Does anyone have any pointers here? I've no idea how to even start writing to AD, if it can be done.
Ideally, it'd also be nice to pull both the "Client Room" value another extension attribute, "Client Group", and write those as Apple Remote Desktop info fields 1 and 2. Same deal here, I haven't really worked with the API enough to know where to start, so any help would be very much appreciated.
Posted on 09-06-2016 09:41 AM
Have a look at https://YourJSSServer.edu/api Getting data from the JSS via the API is pretty easy. You can pull XML or JSON.
#!/bin/sh
server="https://my.school.edu:8443"
curl -H "Accept: application/xml" -sfku "$username:$password" "$server/JSSResource/computerextensionattributes/name/myFavoriteExtension" -X GET | xmllint --format - > /tmp/myFavEA.xml
Posted on 09-06-2016 10:50 AM
Any advice on how to hide username:password in a script like this? What's best practice from a security point of view?
Posted on 09-06-2016 10:52 AM
https://github.com/jamfit/Encrypted-Script-Parameters
It's a bit of a challenge, but there's one solution that JAMF uses...