Skip to main content
Solved

Extension Attributes script - help

  • February 26, 2021
  • 2 replies
  • 27 views

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>"

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.