Interactive Script to Join Mac OS 10.7 to Active Directory

According to this document from Apple :  You may have trouble using the Directory Utility if your domain is setup such that the Netbios name and host name are not the same.  This is the situation I find myself in, so I thought I would post a sample script to help others out…

The script can be found here


5 thoughts on “Interactive Script to Join Mac OS 10.7 to Active Directory

  1. Vaughn,

    Thanks for the great script example. I am working on building off of yours to apply to our environment. In the portion of the script where you apply the -mobile and -mobileconfirm switches…would this be a good place to add other advanced switches to offset what I would normally select in the Dir. Utility GUI?

    Thanks again!

  2. Hi Nick,

    Yes, that is the portion of the script where you would want to set other options. In my particular case, those were the only options I was needing to change. You can run “man dsconfigad” in terminal to get the correct syntax to set different options.


    • Thanks, I was pretty familiar with the switches but needed a way for things to be more interactive than my current script. If this was adapted for 10.8, what would need to be changed? I have made changes to the check OS version in the following line:

      if [ $majorSysver = 10.8 ]; then

      Would I need to change information in the $minorSysver line as well? Where can I learn more about the information being pulled for this check? I’m wondering if judging from the search provider lines below those that the Search path will show up differently in 10.8 as well, depending on update installed. I’ll probably have a few more questions about the general function of the script. I’m trying to learn, and thanks in advance for sharing your knowledge.

      • I haven’t been using this script as much any more, because I’ve been using Deploy Studio to configure Macs and it has built in domain join information.

        It is important to test against each version in your own environment and make the needed change. If you find the same search path settings work for 10.8, you can just change the major version check to looking for greater than or equal rather than just equal.

        The version check logic in general is useful for many scripts.

        • Coincidentally, I find myself needing to dust off this script to provide to someone running a departmental lab. I just did some testing in 10.8 and it looks like the search path modification is not needed for 10.8 in my environment.

          Again, you want to test against your environment and adjust the script accordingly.

Leave a Reply

Your email address will not be published. Required fields are marked *