Skip to main content

I am getting this error for the script below – any ideas?:
attribute status: eDSAttributeValueNotFound
DS Error: -14143 (eDSAttributeValueNotFound)
attribute status: eDSAttributeValueNotFound
DS Error: -14143 (eDSAttributeValueNotFound)
/private/tmp/LionADsearchPathFix3.sh: line 15: syntax error near unexpected token `else'
/private/tmp/LionADsearchPathFix3.sh: line 15: `else '



#!/bin/bash

dsconfigad -alldomains disable

csp="dscl /Search -read / CSPSearchPath | grep /Active"

if dscl /Search -read / CSPSearchPath | grep /Active > /dev/null
then
/usr/bin/dscl /Search -change / CSPSearchPath "$csp" "/Active Directory/tree/domain.com"

/usr/bin/dscl /Search/Contacts -change / CSPSearchPath "$csp" "/Active Directory/tree/domain.com"
fi

else

dscl /Search -append / CSPSearchPath "/Active Directory/tree/domain.com"

dscl /Search -create / SearchPolicy dsAttrTypeStandard:CSPSearchPath

dscl /Search/Contacts -append / CSPSearchPath "/Active Directory/tree/domain.com"

dscl /Search/Contacts -create / SearchPolicy dsAttrTypeStandard:CSPSearchPath

exit 0

the fi on the line before the else is likely your problem.


that was the white space issue after reading dscl. But this worked better at the end... so no need to fix that ;)



#!/bin/bash

dsconfigad -alldomains disable
rm /Library/Preferences/OpenDirectory/Configurations/Contacts.plist
rm /Library/Preferences/OpenDirectory/Configurations/Search.plist
killall opendirectoryd

dscl /Active Directory/tree/domain.com -read /Users/testuser > /dev/null

dscl /Search -create / SearchPolicy CSPSearchPath
dscl /Search/Contacts -create / SearchPolicy CSPSearchPath

dscl /Search -append / CSPSearchPath "/Active Directory/tree/domain.com"
dscl /Search/Contacts -append / CSPSearchPath "/Active Directory/tree/domain.com"

exit 0


funny thing is that if I didn't do;
dscl /Active Directory/tree/domain.com -read /Users/testuser > /dev/null



then it wouldn't work??? strange...


wait ;
need to put sleep command too...
after
killall opendirectoryd
sleep 5


Reply