부서 이름의 문자열 목록을 가져 오기 위해 Active Directory를 쿼리하는 가장 쉬운 방법은 무엇입니까? 예 : "Finance", "Marketing", "IT"등. 내 케이스는 3000 명이 넘는 사용자가있는 엔터프라이즈의 활성 디렉토리입니다.C#을 사용하여 Active Directory에서 부서 목록을 얻는 방법
1
A
답변
6
Department 특성이 반환 된 개체 목록을 가져 오려면 System.DirectoryServices 네임 스페이스에서 DirectorySearcher를 사용할 수 있다고 가정합니다.
그런 다음 필터는 같은 것이다 :
ds.Filter = "(objectClass=user)";
그리고 당신은 단지 부서 특성로드 수색자 말할 수 :
ds.PropertiesToLoad.Add("department");
그런 다음 결과 집합 throught를 열거 :
을SearchResultCollection results = ds.FindAll();
그런 다음 각 부서 속성을 사전에 추가하여 모든 고유 값을 가져옵니다
foreach (SearchResult result in results)
{
string dept = String.Empty;
DirectoryEntry de = result.GetDirectoryEntry();
if (de.Properties.Contains("department"))
{
dept = de.Properties["department"][0].ToString();
if (!dict.ContainsKey(dept))
{
dict.Add(result.Properties["department"][0].ToString();
}
}
}
는 다른 방법으로, 같은 DSQUERY 또는하여 adfind 당신이 정보를 제공합니다 명령 줄 도구가 있습니다.
adfind -default -f "(objectclass=user)" department -list | sort
은 모든 사용자에 대해 부서 속성의 정렬 된 목록을 제공합니다.
관련 문제
- 1. Active Directory에서 특정 부서에 속한 모든 사용자의 목록을 얻으려면 어떻게합니까?
- 2. Active Directory에서 Organizational Units 목록을 얻으려면 어떻게합니까?
- 3. Active Directory에서 SSL 설정 방법
- 4. Active Directory에서 사용자의 도메인 찾기
- 5. Active Directory에서 롤백이 가능합니까?
- 6. Active Directory 그룹에서 그룹 목록을 얻는 방법
- 7. .NET의 Active Directory에서 필요한 최소 암호 길이 값을 얻는 방법
- 8. Active Directory에서 CSLA.NET 사용
- 9. LDAP를 통해 Active Directory에서 그룹 가져 오기
- 10. Active Directory에서 전체 이름 업데이트
- 11. Active Directory에서 사용자 그룹을 얻는 방법은 무엇입니까? (C#, asp.net)
- 12. Active Directory에서 선택한 계정 복제
- 13. 도메인 주소를 Active Directory에서 확인하십시오.
- 14. Active Directory에서 역할이있는 사용자를 얻으십시오.
- 15. 프로그래밍 방식으로 Active Directory에서 메일 그룹 만들기
- 16. Active Directory에서 Perl의 사용자 계정을 활성화하십시오.
- 17. Active Directory에서 사용자 가져 오기 및 내보내기
- 18. Active Directory에서 컴퓨터 이름 가져 오기
- 19. WindowsIdentity.Name이 Active Directory에서 새 이름을 반환하지 않습니다.
- 20. 부서 또는 회사 목록을 검색하는 LDAP 쿼리
- 21. Active Directory
- 22. Active Directory에서 PHP로 사용자 및 암호 내보내기
- 23. Active Directory에서 ActiveDirectoryAccessRule의 유형은 어떻게 결정합니까?
- 24. Active Directory에서 사용자 개체 특성을 지우려면 어떻게합니까?
- 25. Active Directory에서 사용자의 LastPasswordSet 날짜 설정
- 26. commitChanges() 호출은 Active Directory에서 아무 일도하지 않습니까?
- 27. Active Directory에서 사용자의 그룹 구성원 쿼리
- 28. Active Directory에서 phpBB를 인증하는 데 문제가 있습니다.
- 29. Active Directory에서 모든 직접 보고서 가져 오기
- 30. C#을 통해 Active Directory에서 사용자 삭제
adfind는 'Windows 운영 체제 용 원격 서버 관리 도구 (https://support.microsoft.com/en-us/kb/2693643) 용 RSAT (원격 서버 관리 도구)'의 일부입니다. 프리웨어는이 도구의 향상된 버전을 제공합니다. http://www.joeware.net/freetools/ – BiLaL