Setting EA to detect Domain

New Contributor II

I'm trying to create an EA to show when the device is added to domain, so then I can make a smart group based off of that.


The script I'm trying to use is:

domainName=`echo show |
scutil | grep DomainNameFlat | awk '{print $3}'`

echo "$domainName "


When I run that in terminal, it gives me the result that I expect, but when I use that script as an EA, none of my devices are reporting in that field yet.


Legendary Contributor III

This is already a built in piece of criteria, called "Active Directory Status" Maybe I'm missing something, but why are you trying to create your own EA for this? Though the built in one returns in the format of, not just "domain" like yours does.

But to answer your question, all Extension Attributes need to echo or print the result back between <result></result> tags, so your last line in the EA script should be echo "<result>$domainName</result>"