Skip to main content
Question

Script to pull Extension Attribute value and write to AD description field?


Forum|alt.badge.img+2

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.

3 replies

Forum|alt.badge.img+15
  • Contributor
  • 589 replies
  • September 6, 2016

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

Forum|alt.badge.img+4
  • New Contributor
  • 4 replies
  • September 6, 2016

Any advice on how to hide username:password in a script like this? What's best practice from a security point of view?


Forum|alt.badge.img+15
  • Contributor
  • 589 replies
  • September 6, 2016

https://github.com/jamfit/Encrypted-Script-Parameters

It's a bit of a challenge, but there's one solution that JAMF uses...


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings