How can I determine the Active Directory (AD) site to which a client computer is connected?
You can use the AD System Info object's SiteName property to fetch the local computer's site name. Windows 2000 and later includes the ADSystemInfo object, which is also known as the IADsADSystemInfo interface in Active Directory Service Interfaces (ADSI). This object lets you retrieve data about a local computer if that computer is a Win2K (or later) machine and is in a Win2K domain. As callout A in Listing 4 shows, to create an instance of this object, you use the object's programmatic identifier (ProgID), ADSystemInfo, in VBScript's CreateObject function. To learn more about this extremely useful object, see the "IADsADSystemInfo" topic in the ADSI software development kit (SDK) at http://msdn.microsoft.com/library/en-us/netdir/adsi/iadsadsysteminfo.asp.