0
VB.net 응용 프로그램 내에서 사용자 ID 드롭 다운 목록을 채우는 코드가 있습니다. 일부 사용자 이름이 반환되지 않습니다. 나는 1000 개가 넘는 결과를 얻었으므로 1000 개 한계로 보이지 않습니다. 검색 필터에 (sAMAccountName = Kry *)를 추가하면 표시되지 않는 사용자 (이름이 kry로 시작하는)가 반환됩니다. 이것에 대한 도움은 크게 감사 할 것입니다. 감사!Active Directory 검색이 모든 사용자를 반환하지 않습니다.
Private Sub PopSecurityUser()
cboUser.Items.Clear()
Dim SearchRoot As DirectoryEntry = ActiveDirectory.Forest.GetCurrentForest.RootDomain.GetDirectoryEntry '< More portable. Discover domain root DirectoryEntry rather than hard coding a Global Catalog.
Dim AdObj As System.DirectoryServices.SearchResult
Dim Searcher As New DirectorySearcher(SearchRoot)
With Searcher
.PropertiesToLoad.Add("sAMAccountName")
.SearchScope = SearchScope.Subtree
.Filter = "(&(!objectClass=contact)(objectCategory=person)(objectClass=user))" '< Exclude contacts because they don't have a sAMAccountName property.
.ReferralChasing = ReferralChasingOption.All '< Causes lookups to follow LDAP referrals if the object doesn't exist on the queried domain controller.
End With
For Each AdObj In Searcher.FindAll
If Not IsNumeric(AdObj.Properties("sAMAccountName")(0).ToString.Substring(0, 1)) Then
cboUser.Items.Add(AdObj.Properties("sAMAccountName")(0))
End If
Next
cboUser.Sorted = True
End Sub
저는 1232 명의 사용자를 확보하고있어서 1000 한계라고 생각하지 않습니다. 마지막으로 (userAccountControl = 512)를 사용 중지 된 계정을 제외하도록 추가했는데 누락 된 사용자를 포함하여 약 800 개의 행이 반환되었습니다. – gcresse
아, 죄송합니다. "... 1,000 개가 넘는 답장"명세서를 간과 한 것 같습니다. 그럼에도 불구하고 솔루션을 찾을 수있어서 다행입니다. – David