Terminal – How to Unbind a Mac from AD Using Command Line

active-directorycommand linemacosterminal

Currently I am using the below command line to bind any Mac to my AD, and so far has been work perfectly.

dsconfigad -a hostname -u DomainAdminsUserName -p Password --ou "CN=Computers,DC=hello,DC=com" -domain hello.com -mobile enable -mobileconfirm enable -localhome enable -useuncpath enable -groups "Domain Admins,Enterprise Admins" -alldomains enable

reboot

Question, how do I unbind a Mac from AD to reverse the above configuration using the command line?

Best Answer

dsconfigad -remove -u DomainAdminsUserName -p Password

If that doesn't work, you may need to add -force.