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

shMorganson
New Contributor II

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!

1 ACCEPTED SOLUTION

sshort
Valued Contributor

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}')"

View solution in original post

4 REPLIES 4

mark_mahabir
Valued Contributor

Are you using macOSLAPS? Or LAPSforMac?

shMorganson
New Contributor II

I am using LAPSforMac.

Br3ck
New Contributor III

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

sshort
Valued Contributor

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}')"