Checks if a domain controller is in a specific Active Directory site
strDcName = "atl-dc-01"strSiteName = "ga-atl-sales"Set objADSysInfo = CreateObject("ADSystemInfo")strDcSiteName = objADSysInfo.GetDCSiteName(strDcName)If UCase(strSiteName) = UCase(strDcSiteName) ThenWScript.Echo "TRUE: " & strDcName & " is in site " & strSiteNameElseWScript.Echo "FALSE: " & strDcName & " is NOT in site " & strSiteNameEnd If
This is a VB Script, this can be used by saving the file in .vbs file