Skip to main content
Solved

Extension Attributes script - help


Forum|alt.badge.img+6
  • Contributor
  • 45 replies

Hello,

I'm trying to get the two commend below to display in Extension Attributes.

cat /etc/passwd | grep '^.*:0:.*' | wc -l
shasum /etc/sudoers | sed 'sX/etc/sudoersXX'

thanks in advance.

Best answer by kyle_erickson

The documentation is pretty good here for extension attributes with a script where your output must be returned as XML. You can have additional output, but the value of the attribute is specified with the <result> tag (e.g. "<result>Attribute Value</result>")

https://docs.jamf.com/10.27.0/jamf-pro/administrator-guide/Computer_Extension_Attributes.html

For example, in your case here for the first command I'd do this:

#!/bin/sh
Result=$(cat /etc/passwd | grep '^.*:0:.*' | wc -l | sed 's/ //g')
echo "<result>$Result</result>"

For the second one, I'd probably do this:

#!/bin/sh
Result=$(shasum /etc/sudoers | sed 'sX/etc/sudoersXX')
echo "<result>$Result</result>"
View original
Did this topic help you find an answer to your question?

2 replies

Forum|alt.badge.img+8
  • Contributor
  • 18 replies
  • Answer
  • February 26, 2021

The documentation is pretty good here for extension attributes with a script where your output must be returned as XML. You can have additional output, but the value of the attribute is specified with the <result> tag (e.g. "<result>Attribute Value</result>")

https://docs.jamf.com/10.27.0/jamf-pro/administrator-guide/Computer_Extension_Attributes.html

For example, in your case here for the first command I'd do this:

#!/bin/sh
Result=$(cat /etc/passwd | grep '^.*:0:.*' | wc -l | sed 's/ //g')
echo "<result>$Result</result>"

For the second one, I'd probably do this:

#!/bin/sh
Result=$(shasum /etc/sudoers | sed 'sX/etc/sudoersXX')
echo "<result>$Result</result>"

Forum|alt.badge.img+6
  • Author
  • Contributor
  • 45 replies
  • March 1, 2021

@kyle.erickson Thank you.


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