Skip to main content
Question

script help!

  • September 13, 2012
  • 3 replies
  • 0 views

Forum|alt.badge.img+17
  • Contributor
  • 352 replies

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

3 replies

Forum|alt.badge.img+18
  • Valued Contributor
  • 1007 replies
  • September 13, 2012

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


Forum|alt.badge.img+17
  • Author
  • Contributor
  • 352 replies
  • September 13, 2012

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...


Forum|alt.badge.img+17
  • Author
  • Contributor
  • 352 replies
  • September 13, 2012

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


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings