PhoenixUA
Silver Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору Set objRootDSE = GetObject("LDAP://RootDSE") strDNSDomain = objRootDSE.Get("defaultNamingContext") ' Use the NameTranslate object to find the NetBIOS domain name from the ' DNS domain name. Set objTrans = CreateObject("NameTranslate") objTrans.Init ADS_NAME_INITTYPE_GC, "" objTrans.Set ADS_NAME_TYPE_1779, strDNSDomain strNetBIOSDomain = objTrans.Get(ADS_NAME_TYPE_NT4) ' Remove trailing backslash. strNetBIOSDomain = Left(strNetBIOSDomain, Len(strNetBIOSDomain) - 1) ' Use the NameTranslate object to convert the NT user name to the ' Distinguished Name required for the LDAP provider. objTrans.Set ADS_NAME_TYPE_NT4, strNetBIOSDomain & "\" & strNTName strUserDN = objTrans.Get(ADS_NAME_TYPE_1779) ' Bind to the user object in Active Directory with the LDAP provider. Set objUser = GetObject("LDAP://" & strUserDN) If (IsMember(objUser, "group") = True) Then ... End If ... Function IsMember(objADObject, strGroup) ' Function to test for group membership. ' objADObject is a user or computer object. ' strGroup is the NT Name of the group to test. ' objGroupList is a dictionary object with global scope. ' Returns True if the user or computer is a member of the group. ' Subroutine LoadGroups is called once for each different objADObject. If (IsEmpty(objGroupList) = True) Then Set objGroupList = CreateObject("Scripting.Dictionary") End If If (objGroupList.Exists(objADObject.sAMAccountName & "\") = False) Then Call LoadGroups(objADObject, objADObject) objGroupList. Add objADObject.sAMAccountName & "\", True End If IsMember = objGroupList.Exists(objADObject.sAMAccountName & "\" _ & strGroup) End Function | Всего записей: 2184 | Зарегистр. 17-11-2005 | Отправлено: 14:48 17-01-2008 | Исправлено: PhoenixUA, 14:49 17-01-2008 |
|