I have been assigned to a project to integrate another facility’s computers into our domain. I’m trying to script the domain join process but I keep receiving an error indicating the format of the specified domain name is invalid. If I go through the GUI it accepts the domain name just fine and everything is right as rain. The code I’m attempting to us is as follows:
I’ve surfed around a bit and a few sites suggested it could be a DNS issue, and that the primary DNS had to be pointing to the DC for the domain I wish to join, but making that change had no impact on resolving the error even after clearing the local dns cache.
It’s definitely name resolution. I wouldn’t say changing the DNS, necessarily, but make sure the existing DNS server knows how to reach the other domain’s DCs. When you use the GUI, a whole different set of protocols can end up getting involved - it does more under the hood work for you. An alternate would be to temporarily, via script, hack the hosts file on the machine so it can find the remote domain. Or hack lmhosts so it can find the domain by its NetBIOS (short) name.