Posted on 02-26-2021 11:59 AM
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.
Solved! Go to Solution.
Posted on 02-26-2021 02:45 PM
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>"
Posted on 02-26-2021 02:45 PM
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>"
Posted on 03-01-2021 08:30 AM
@kyle.erickson Thank you.