When a Windows client comes online, it must find a domain controller to bind to. Either through a static configuration or DHCP, the client will request a list of all Domain Controllers in the domain from a DNS server. Once the list is received, the client will randomly go through the list to find a DC that will respond. Once the client has authenticated itself with the DC, the DC will transmit the site information to the client. The site information will contain the site name, the subnet(s) associated with that site, and any domain controllers in that site. The client will then take a look at it’s own IP address to determine which site it is in. From the list of DCs in the same site, it will attempt to bind to one of those DCs to receive it’s Group Policies.
You can use PowerShell and WMI to locate the domain controller that a client is connected to.
Look for the DomainControllerName property.