Lm th? no ? truy v?n Active Directory b?ng cch s? d?ng m?t b? l?c bit

D?ch tiu ? D?ch tiu ?
ID c?a bi: 269181
Bung t?t c? | Thu g?n t?t c?


M?t s? thu?c tnh vo ?i t?ng Active Directory ?c t?o thnh t? bit c?. B?n c th? c?n ? truy v?n cho cc ?i t?ng b?ng cch s? d?ng m?t nh i?u hnh bit ? tr? v? ch? cc ?i t?ng ph h?p v?i m?t cht c? th? ?c thi?t l?p. S? d?ng cc i?u khi?n Lightweight Directory Access Protocol (LDAP) m ph h?p v?i quy t?c ? lm i?u ny.


?nh d?ng c?a LDAP ph h?p v?i quy t?c c c php sau:
attributename:ruleOID:=gi tr?
ni attributename l LDAPDisplayName c?a cc thu?c tnh, ruleOID l ?i t?ng ID (Anh) cho s? ki?m sot quy t?c ph h?p, v gi tr? l gi tr? th?p phn b?n mu?n s? d?ng ? so snh. B?n c?n ph?i chuy?n ?i t? h? th?p l?c phn sang th?p phn.

Gi tr? c?a ruleOID c th? l m?t trong nh?ng i?u sau y:
  • 1.2.840.113556.1.4.803 - y l cc quy t?c LDAP_MATCHING_RULE_BIT_AND. Cc quy t?c ph h?p l ng ch? n?u t?t c? cc bit t? ti s?n ph h?p v?i gi tr?. Quy t?c ny l gi?ng nh cc nh i?u hnh v bit.
  • 1.2.840.113556.1.4.804 - y l cc quy t?c LDAP_MATCHING_RULE_BIT_OR. Cc quy t?c ph h?p l ng n?u b?t k? bit t? ti s?n ph h?p v?i gi tr?. Quy t?c ny l gi?ng nh cc nh i?u hnh OR bit.
M?t v d? l khi b?n mu?n truy v?n Active Directory cho ?i t?ng l?p ng?i dng b? v hi?u ho. Cc thu?c tnh ch?a thng tin ny l cc userAccountControl thu?c tnh. Thu?c tnh ny g?m c m?t s? k?t h?p c?a l c? khc nhau. L c? ? thi?t l?p cc ?i t?ng m b?n mu?n v hi?u ho l UF_ACCOUNTDISABLE, trong c m?t gi tr? c?a 0x02 (2 th?p phn). B? l?c bit so snh m ch? ?nh userAccountControl v?i UF_ACCOUNTDISABLED cht t?p s? gi?ng v?i i?u ny:
Sau k?ch b?n m?u Microsoft Visual Basic s? d?ng ? trn bit so snh l?c:
Set oNSP = GetObject("LDAP://Win2000Server/rootdse")
Set oConfig = GetObject("LDAP://Win2000Server/" & oNSP.get("DefaultNamingContext"))

Set oConn = CreateObject("ADODB.Connection")
oConn.Provider = "ADSDSOObject"
oConn.Open ""

strQuery = "<" & oConfig.ADsPath & ">;(&(objectCategory=person)(objectClass=User)(userAccountControl:1.2.840.113556.1.4.803:=2));name,objectClass;subtree"

Set oRS = oConn.Execute(strQuery)
While Not oRS.EOF
  MsgBox oRS.Fields("name") 

MsgBox "done"

Set oConn = Nothing
Set oRS = Nothing
Set oConfig = Nothing
Set oNSP = Nothing


? bi?t thm chi ti?t v? cch s? d?ng quy t?c ph h?p v?i LDAP, xem Kit pht tri?n ph?n m?m n?n t?ng (SDK). Thng tin ny ?c t?m th?y trong cc n?i dung t?i:

Networking and Directory Services
  Active Directory, ADSI, and Directory Services
     Active Directory
        Using Active Directory
           Searching the Active Directory
             Creating a Query Filter
                 How to Specify Comparison Values 

? bi?t thm chi ti?t v? cch s? d?ng quy t?c ph h?p v?i LDAP, xem cc m?u bao g?m trong SDK n?n t?ng. Cc m?u ?c ?t t?i cc \Microsoft PlatformSDK\Samples\NetDs\ADSI\Samples\ActiveDir\Attributes v SDK\Samples\NetDs\ADSI\Samples\ActiveDir\GetSchemaInfo th m?c.

Thu?c tnh

ID c?a bi: 269181 - L?n xem xt sau cng: 22 Thang Tam 2011 - Xem xt l?i: 2.0
T? kha:
kbhowto kbmsg kbmt KB269181 KbMtvi
My d?ch
QUAN TRONG: Bi vi?t ny ?c d?ch b?ng ph?n m?m d?ch my c?a Microsoft ch? khng ph?i do con ng?i d?ch. Microsoft cung c?p cc bi vi?t do con ng?i d?ch v c? cc bi vi?t do my d?ch ? b?n c th? truy c?p vo t?t c? cc bi vi?t trong C s? Ki?n th?c c?a chng ti b?ng ngn ng? c?a b?n. Tuy nhin, bi vi?t do my d?ch khng ph?i lc no c?ng hon h?o. Lo?i bi vi?t ny c th? ch?a cc sai st v? t? v?ng, c php ho?c ng? php, gi?ng nh m?t ng?i n?c ngoi c th? m?c sai st khi ni ngn ng? c?a b?n. Microsoft khng ch?u trch nhi?m v? b?t k? s? thi?u chnh xc, sai st ho?c thi?t h?i no do vi?c d?ch sai n?i dung ho?c do ho?t ?ng s? d?ng c?a khch hng gy ra. Microsoft c?ng th?ng xuyn c?p nh?t ph?n m?m d?ch my ny.
Nh?p chu?t vo y ? xem b?n ti?ng Anh c?a bi vi?t ny:269181
Khc t Ni dung trong C s Kin thc Khng con c h tr
Bi vi?t ny ni v? cc s?n ph?m m Microsoft khng c?n h? tr? n?a. Do , bi vi?t ny ?c cung c?p "nguyn b?n" v s? khng ?c c?p nh?t.

Cung cp Phan hi


Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com