Sections
Top  Previous  Next


All SetupBatcher scripts are divided into sections. A section can contain settings, machines, commands or data.

Script example

[Settings_Begin]
BatchSettings.Delimiter=TAB
BatchSettings.MarkerCol=4
[Settings_End]

[Machines_Begin]
\\EDU12      NT PDC    
[Machines_End]

[Batch_Begin]
Data.Loop   
 Account.Rename %col2%,%col3%   
Data.EndLoop   
[Batch_End]

[Data_Begin]
   OldAccountName1   NewAccountName1
   OldAccountName2   NewAccountName2
[Data_End]


About the script

The above script will first rename SamAccount "OldAccountName1" to "NewAccountName1" and then rename account "OldAccountName2" to "NewAccountName2". (Replace Account.Rename with AD.Account.SetProperty to rename accounts in active directory.)

·[Settings]: "BatchSettings.Delimiter=TAB" means that the TAB character (ascii code 9) is used as delimiter in the [Data] section.  
·[Settings]: "BatchSettings.MarkerCol=4" means that the fourth column in the [Data] section is used for status markers, SetupBatcher uses this column to indicate the progress of the script. If you try to write anything in this column it will be overwritten when the script starts.  
·[Machines]: The script will be executed on the server \\EDU12.  
·[Batch]: "Account.Rename %col2%,%col3%" command inside Data.Loop..EndLoop statement - %col2% refers to column two in the [Data] section and %col3% refers to column three.  
·[Data]: There is data in column two and three.  

Section overview

Section
Start + end label
Mode
Mandatory
Description
[Settings]

[Settings_Begin]
[Settings_End]
Batch + Undo
Yes*
Aliases, constants, parameters that does not change, general script settings.
[DataFiles]
[DataFiles_Begin]
[DataFiles_End]
Batch only
No
A list of text files that automatically are loaded into the [Data] section and executed one by one.

Use the $GetDataFiles command in the [DataFiles] section to fill the section with files from a directory from an FTP server or from an email server.
[Machines]
[Machines_Begin]
[Machines_End]   
Batch+
Undo
No
NT machines that the [Batch] or [Undo] section are executed on. (NT = NT3.51, NT4, 2000, XP or 2003)

Linux and Novell notice: the [Machines] section can only be used Windows machine names. If a script only runs on Linux or Novell - remove this section from the script.
[Init]
[Init_Batch_Begin]
[Init_Batch_End]
Batch only
*
Initialization commands.

This section runs once before the [Batch] section. One time only and independent of number of machines in the [Machines] section.

Use this section to, for example, fill the [Data] section with data that should be the same for all machines in a script.
[Batch]
[Batch_Begin]
[Batch_End]
Batch only
*
Batch commands.

The [Batch] section is the most commonly used command section.
[Undo]
[Undo_Batch_Begin]
[Undo_Batch_End]
Undo only
*
Undo commands.

Use this section to "undo" the commands in the [Batch] section. "Undo" is just what we call it, think of it as "script section two" or "alternate script section".

Example: delete user accounts, shares, DNS zones etc.
[OnError]
[OnError_Batch_Begin]
[OnError_Batch_End]
Batch only
No
OnError commands.

This section is executed when an error is found, before the script stops.

Example: save the script with status markers and alert the Administrator through a command line emailer or through net send.
[Data]
[Data_Begin]
[Data_End]
Batch+
Undo
No
Data - parameters - properties - list of items - example: accounts, passwords, directories etc. to process in the [Init], [Batch] or [Undo] batch section.
[xData]
[xData_name_Begin]
[xData_name_End]
Batch+
Undo
No
User defined extra data sections used with xData.Loop..EndLoop


*) All scripts must contain at least two sections; [Settings]+[Init], [Settings]+[Batch] or [Settings]+[Undo]. One script can contain all sections.

How the sections are used in a script


·The [Init], [Batch] and [Undo] sections all uses the same [Settings] and [Data] sections.  
·The [Batch] and [Undo] section uses the same [Machines] section.  
·The [OnError] and the [Init] sections are only used in [Batch] mode.  

Batch mode (CTRL+R)

If [Datafiles] section exist, then for each file in [Datafiles] section - loop below, else run below  
If [Init]section exits - run it  
If [Machines] section exists, then for each machine in [Machines] section - loop below, else run below  
If [Batch] section exists - run it  
     
If Error  
If [OnError] section exists - run it  

Undo batch mode (CTRL+U)

If [Machines] section exists, then for each machine in [Machines] section - loop below, else run below  
If [Undo] section exists - run it  
   
Data.Loop..EndLoop statement

·The Data.Loop..EndLoop statement can be used in the [Init], [Batch] and [Undo] sections.  

If Data.Loop..EndLoop statement exists, then for each row in [Data] section, loop commands between Data.Loop and Data.EndLoop