Hi,
I am trying to create a script to populate a extension attribute with the Active Directory canonical name. This is what my attempt (blundering attempt, I have no experience either in bash scripting or JAMF):
!/bin/sh
DomainName=$(dsconfigad -show | awk '/Active Directory Domain/{print $NF}')
CompName=$(dsconfigad -show | grep "Computer Account" | awk '{ print $4 }')
CanonicalName=$(dscl "/Active Directory/${DomainName}/All Domains" read /Computers/${CompName}$ dsAttrTypeNative:CanonicalName | tail -1 | awk -F ':' '{print $3}')
echo "<result>${CanonicalName}</result>"
exit 0
Thanks