At work I have a script to bind machines during enrollment.
is there a way to check to see if its bound to AD to skip the bind script and continue with enrollment?
thank you.
At work I have a script to bind machines during enrollment.
is there a way to check to see if its bound to AD to skip the bind script and continue with enrollment?
thank you.
Best answer by mike_pinto
Maybe something like this? @mm2270 had posted this here
You'd just have to modify it to fit your needs.
if ping -c 2 -o dc.domain.comp.org; then
if [[ $(dsconfigad -show | awk '/Active Directory Domain/{ print $NF }') == "domain" ]]; then
ADCompName=$(dsconfigad -show | awk '/Computer Account/{ print $NF }')
security find-generic-password -l "/Active Directory/domain" | grep "Active Directory"
if [ "$?" == "0" ]; then
dscl "/Active Directory/domain/" read /Computers/"$ADCompName" | grep -i "$ADCompName"
if [ "$?" == "0" ]; then
echo "Already bound"
else
bind
fi
else
bind
fi
else
bind
fi
else
echo "Not on the network"
fi
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.