use constant ADS_UF_ACCOUNTDISABLE => 2; use constant ADS_SCOPE_SUBTREE => 2;
my $objConnection = Win32::OLE->new( "ADODB.Connection" ); my $objCommand = Win32::OLE->new( "ADODB.Command" );
# open ad $objConnection -> open( "Provider=ADsDSOObject;" );
$objCommand -> = $objConnection;
# search what and how $objCommand -> = "select userAccountControl,distinguishedName from 'GC://dc=china,dc=microsoft,dc=com' where objectCategory='user'";
my $objRecordSet = Win32::OLE->new( "ADODB.Recordset" ); $objRecordSet = $objCommand->Execute( ) || die "query data from active directory error,exit\n";
while( not $objRecordSet -> eof ) { my $intUAC = $objRecordSet -> Fields("userAccountControl") -> value;