Extension Attributes script - help

bmee
Contributor

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.

1 ACCEPTED SOLUTION

kyle_erickson
New Contributor III

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 solution in original post

2 REPLIES 2

kyle_erickson
New Contributor III

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

bmee
Contributor

@kyle.erickson Thank you.