Home > windows > Win 2008 Join Domain with PDC IP but no Domain Name of the AD

Win 2008 Join Domain with PDC IP but no Domain Name of the AD

December 2Hits:1

I would like to write script to allow a workstation to join a domain. I have the IP address of the primary DC of this domain. Are there any commands / scripts that I can use to retrieve the domain name of this AD domain such that the domain name can be retrieved for the join domain operation?

All workstations / DCs are Windows Server 2008.

There are two NICs on the workstations / DCs. One of them is used for network load balancing (NLB) and the other is used for management. The default gateway is only set on the NIC for NLB while the IP Address I have is the management one. No reverse DNS zones were setup in the primary DC and changing the settings of it is not preferred.


Some ideas:

You could simply use nslookup to resolve the IP address to a DNS name like nslookup, but this obviously would not work if a reverse lookup zone has not been set up by the administrator.

Another way would be relying on the DNS suffix provided by the DHCP server - simply query ipconfig /all | find /I "suffix" to get to this information. This also would only work if the administrator has configured the DHCP scope correctly and the client is getting its address via DHCP.

If you can't rely on anything of the above to give correct information, consider using VBScript or PowerShell for binding to the AD LDAP service and querying the RootDSE object for properties to find out the domain name. This should work even using an anonymous bind - i.e. without providing credentials. From there, you should be able to query the _ldap._tcp.pdc._msdcs.yourdomain SRV record to find the name of the PDC.

You could always use the tool nbtstat -A a.b.c.d. Then figure out what the record is with the 00 netbios suffix. Netbios is less, and less common these days.

There's a tool in Powershell that will join the local machine to a domain. There are two problems, though. The first is that you must be able to contact the domain from that machine. Is the machine set to use the DNS server for that domain?

Second, you can use nslookup on the IP of the domain controller to get the reverse DNS entry for it. Just parse the output for the line with the hostname in it. Again, your DNS must be set up correctly on the box for this to happen. This blog post details how to set the DNS server, again in Powershell.

Let us know if you get this working, this sounds like a neat little script.

Related Articles

Copyright (C) 2018 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.614 s.