Extract all accounts and AD paths in domain to [Data] section, use multicompare to search for accounts, delete non-matching [Data] rows
Top  Previous  Next


[Settings_Begin]
BatchSettings.Delimiter=TAB
BatchSettings.MarkerCol=4
BatchSettings.MarkersAutoRemove=Yes

SET ADDomainPath=dc=com/dc=acme/dc=d31
SET ADOUPath=%col3%
[Settings_End]

[Machines_Begin]
\\MAIN04      NT PDC    
[Machines_End]

[Init_Batch_Begin]
Data.Get.AD Container,%ADDomainPath%, User, Yes, cn§1§ADpath§2§   
Data.Loop       
 If MultiCompare (%col1%,a1§a2§a3§)=0 Then   
   Data.Row.Delete    
 EndIf   
Data.EndLoop   
If %RowsTotal% = 0 Then           
 MessageBox No accounts found.       
 QuitBatch           
EndIf           
Data.Show   
[Init_Batch_End]

[Batch_Begin]
Data.Loop       
//_Enter your code here_   
// Example: AD.Account.SetProperty %col2%,PWMustChange,No   
Data.EndLoop      
[Batch_End]

[Data_Begin]
[Data_End]

The above code extracts common names to column 1 and active directory paths to column 2. Then searches column 1 for accounts with common names "a1", "a2" and "a3", all non-matching rows are deleted. Finally AD.Account.SetProperty uses the active directory paths in column 2.

Replace cn with samAccountName in the Data.Get.AD command to search by samAccountName.