解决方法
Active Directory
example code in Perl is available here的最佳来源.它来自Robbie Allen,O’Reilly出色的
Active Directory Cookbook的合着者.
Here is an example从他们的食谱代码:
# This Perl code finds all disabled user accounts in a domain. # --------------------------------------------------------------- # Adapted from VBScript code contained in the book: # "Active Directory Cookbook" by Robbie Allen # ISBN: 0-596-00466-4 # --------------------------------------------------------------- # ------ SCRIPT CONfigURATION ------ my $strDomainDN = "<DomainDN>"; # e.g. dc=rallencorp,dc=com # ------ END CONfigURATION --------- use Win32::OLE; $Win32::OLE::Warn = 3; my $strBase = "<LDAP://" . $strDomainDN . ">;"; my $strFilter = "(&(objectclass=user)(objectcategory=person)" . "(useraccountcontrol:1.2.840.113556.1.4.803:=2));"; my $strAttrs = "name;"; my $strScope = "subtree"; my $objConn = Win32::OLE->CreateObject("ADODB.Connection"); $objConn->{Provider} = "ADsDSOObject"; $objConn->Open; my $objRS = $objConn->Execute($strBase . $strFilter . $strAttrs . $strScope); $objRS->MoveFirst; while (not $objRS->EOF) { print $objRS->Fields(0)->Value,"\n"; $objRS->MoveNext; }