Ehcho.com

Bind Macs to Active Directory using the command line

11 Feb 2014 | Last updated: Never

I often bind my client Macs to Active Directory using Remote Desktop. If you want to do several of them at the same time, use the following command.

cn=$(scutil --get LocalHostName);dsconfigad -f -a "$cn" -domain "DOMAIN.NAME.HERE" -u "AD-USERNAME" -p "AD-PASSWORD" -ou "CN=Computers,DC=domain,DC=path" -localpassword "LOCAL-PASSWORD" -localuser "LOCAL-USERNAME"

Compatibility

Tested on OS X 10.8, and 10.9.