Setting EA to detect Domain

Mr_Meaves
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:

#!/bin/bash
domainName=`echo show com.apple.opendirectoryd.ActiveDirectory |
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.

1 REPLY 1

mm2270
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 domain.company.com, 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>"