dsconfigad returns error "authentication server could not be contacted. (5200)", but GUI domain join works without a problem So I've built a "script", to deploy using JAMF. It is pretty much a single command.

It looks like this:

dsconfigad -add "SERVERNAME" -force -computer "COMPUTERNAME" -domain "SELECTED_OU" -username "ADMIN" -password "SOMEPASSWORD"


When run, doesn't matter if from script in Jamf, or typed manually, it failes with error: 


  dsconfig: Authentication server could not be contacted. (5200)


The weirdest thing is it works immedietaly when doing it with GUI (preferences -> Users &amp; Groups -> Login Options -> Network Account Server).

I tried to google it, but nothing seems to work (like an implication, there is some problem with time sync between server and MacOS computer). Any ideas, where to find the solution?
I have resolved this problem. I was specifying SERVERNAME in the command. 

I used to enter something like: SERVER.DOMAIN.Local (as we have *.local domain). Turns out, I had to enter just DOMAIN.Local.