List of accounts to modify from Data.Get.AD command - automatic
Top  Previous  Next


1) Edit by OU example

·This script automatically changes/sets the logon script to "mstudents.bat" for all accounts in the OU "MSStudents" on the server "\\EDU8" in domain d2.acme.com. No other property than the logon script property is affected. Edit the AD.Account.SetProperty row to set other properties.  
·The [Data] section (list of accounts to edit) is automatically filled with the Data.Get.AD command.  

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

SET ADDomainPath=dc=com/dc=acme/dc=D2
SET ADOUName=MSStudents
SET ADOUPath=%ADDomainPath%/ou=%ADOUName%
[Settings_End]

[Machines_Begin]
\\EDU8      NT PDC    
[Machines_End]

[Init_Batch_Begin]
Data.Get.AD Container,%ADOUPath%, User, Yes, CN§1§ScriptPath§2§   
Data.Show      
[Init_Batch_End]

[Batch_Begin]
Data.Loop   
 AD.Account.SetProperty %ADOUPath%/cn=%col1%, LoginScript, mstudents.bat   
Data.EndLoop   
[Batch_End]

[Data_Begin]
[Data_End]

This is the same script as the one in the previous example but with an added [Init_Batch] section:

·The Data.Get.AD command automatically fills the [Data] section. (The ScriptPath property is extracted in order to see what is going change.)  
·The Data.Show command displays the data section in a dialog so it can be reviewed before anything is changed.  

2) Edit by group membership example

·This script automatically changes/sets the logon script to "mstudents.bat" for all accounts that are member of the group "MyGroup" on the server "\\EDU8" in domain d2.acme.com. No other property than the logon script property is affected. Edit the AD.Account.SetProperty row to set other properties.  
·The [Data] section (list of accounts to edit) is automatically filled with the Data.Get.AD command.  

[Settings_Begin]
BatchSettings.Delimiter=TAB
BatchSettings.MarkerCol=4
BatchSettings.MarkersAutoRemove=Yes
SET ADDomainPath=dc=com/dc=acme/dc=D2
SET ADGroupPath=%ADDomainPath%/ou=MyOu/cn=MyGroup
SET ADOUPath=%col3%
[Settings_End]

[Machines_Begin]
\\EDU8      NT PDC    
[Machines_End]

[Init_Batch_Begin]
Data.Get.AD Group,%ADGroupPath%, User, Yes, CN§1§ScriptPath§2§ADpath§3§
Data.Show
[Init_Batch_End]

[Batch_Begin]
Data.Loop   
 AD.Account.SetProperty %ADOUPath%, LoginScript, mstudents.bat   
Data.EndLoop   
[Batch_End]

[Data_Begin]
[Data_End]

Changes from the above edit by OU script:

·The Data.Get.AD command extracts accounts by group membership instead of by container location.  
·The AD.Account.SetProperty command uses the extracted ADpaths to edit accounts.