' Listing 4: The getDNSDomain Function Private Function getDNSDomain() Dim objRootDSE, strDN, strSubDomain, strRootDomain ' Determine the DNS domain name from the RootDSE object. Set objRootDSE = GetObject("LDAP://RootDSE") strDN = Split(objRootDSE.Get("defaultNamingContext"),",") strSubDomain = Mid(strDN(0),InStr(strDN(0),"=") + 1) strRootDomain = Mid(strDN(1),InStr(strDN(1),"=") + 1) getDNSDomain = strSubDomain & "." & strRootDomain Set objRootDSE = Nothing End Function