2014-12-19 4 views
1

특정 조직 단위 또는 그룹에 대해 maxPwdAge 값을 가져오고 싶습니다. 누구나 도와 줄 수 있습니다.활성 디렉토리에서 조직 단위 또는 그룹별로 maxPwdAge를 얻는 방법

도메인 수준의 maxPwdAge를 아래에서 얻을 수 있지만 그룹 또는 OU 수준의 maxPwdAge는 어떻게받을 수 있습니까? 아무도 도와주세요.

long maxPwdAge=0; 
string domain="LDAP://10.10.1.100/OU=Dev,DC=test,DC=com"; 
string adsiUserName="test"; 
string adsiPassword="test"; 
DirectoryEntry entry = new DirectoryEntry(domain, adsiUserName, adsiPassword, AuthenticationTypes.Secure); 
DirectorySearcher mySearcher = new DirectorySearcher(entry); 
string filter = "(maxPwdAge=*)"; //"maxPwdAge=*"; 
mySearcher.Filter = filter; 
SearchResult results = mySearcher.FindOne(); 
if (results != null) 
{ 
Int64 pwdAge = (Int64)results.Properties["maxPwdAge"][0]; 
maxPwdAge = pwdAge/-864000000000; 
} 

답변

0

대부분의 경우 암호로 최대 나이를 필터링하고 속성에 추가하지 않는 것이 좋습니다.