Skip to main content
Answer

Set a stored extension attribute in JSS to a variable in a script.

  • July 8, 2019
  • 4 replies
  • 26 views

shMorganson
Forum|alt.badge.img+4

I have LAPS currently setup in my environment and I would like to make another script that uses the password stored in the LAPS EA for running some commands. I am having a difficult time making a variable that is set to the stored EA in JSS.

Any help would be great!

Best answer by sshort

I'm using the same method, this is what I'm using in another script that pulls the value from the EA titled "LAPS". You'd need to define the variables, as well.

LAPS="$(/usr/bin/curl -s -f -u $apiUser:$apiPass -H "Accept: application/xml" $apiURL/JSSResource/computers/udid/$udid/subset/extension_attributes | xpath "//extension_attribute[name=$extAttName]" 2>&1 | awk -F'<value>|</value>' '{print $2}')"

4 replies

mark_mahabir
Forum|alt.badge.img+15
  • Jamf Heroes
  • July 8, 2019

Are you using macOSLAPS? Or LAPSforMac?


shMorganson
Forum|alt.badge.img+4
  • Author
  • New Contributor
  • July 8, 2019

I am using LAPSforMac.


Forum|alt.badge.img+5
  • New Contributor
  • July 8, 2019

Why wouldn't you just run what you need to as root using JAMF?


Forum|alt.badge.img+15
  • Valued Contributor
  • Answer
  • July 8, 2019

I'm using the same method, this is what I'm using in another script that pulls the value from the EA titled "LAPS". You'd need to define the variables, as well.

LAPS="$(/usr/bin/curl -s -f -u $apiUser:$apiPass -H "Accept: application/xml" $apiURL/JSSResource/computers/udid/$udid/subset/extension_attributes | xpath "//extension_attribute[name=$extAttName]" 2>&1 | awk -F'<value>|</value>' '{print $2}')"