How to create and delete accounts
Top  Previous  Next


Like mentioned earlier, not only the xD buttons are user definable, but also the new and delete account dialog where input fields and underlying script can be set up to meet your specific requirements. In this topic we will first take a look at the new account dialog, then learn how to set up a script and fields for it and finally finish with the delete accounts dialog.

Create accounts

·In the grid - right-click an existing account in the desired target container and select "Create" in the popup menu. The new account dialog is now displayed.  



·The dialog heading shows for which OS and in which container the account is to be created.  
·The script field contains the name of the SetupBatcher script that is executed when the account is created. Click the "change" button to select another script. The dialog remembers last selected script for each OS. Notice that when a new script is selected for an OS in the new account dialog it is also changed for the same OS in the delete account dialog and vice versa, this is in order to always use [Batch] and [Undo] sections from the same script.  
·The "*" character after a field name indicates a mandatory field that must be filled out in order to create an account. Account name and password are always mandatory, if other fields are mandatory or not is user definable.  
·[The "Generate" button is not supported yet and thus disabled.]  
·Click "Random" to generate a password. The password format is defined in the options dialog under "SetupExplorer" / "Password generator". The syntax is the same as for pronounceable passwords in SetupBatcher.  
·Click the "Extra" tab to fill out the Extra fields, all fields on this page are completely user definable.  



·When done, click "OK" to create the account.  
·If mandatory fields are blank when clicking "OK" there will be error messages until filled out correctly.  

About the script behind the new account dialog

A SetupBatcher script is called in the background when an account is created in the new account dialog. This makes it possible for you to decide exactly which actions that should be performed when an account is created, it is for example usually convenient to also create directories, shares and permissions, or even create accounts on more than one server at once.

The AdmWin install directory contains one example "new account" SetupBatcher script for each supported xD button OS; Windows "ADACC.CNU", Linux "LDACC.CNU" and "Novell NDACC.CNU" that you should use as reference for your own scripts. Please go ahead and have a look at them right now.

If you watch the above screen shots from the new account dialog closely you will find a gray index number top right of each input field. The number indicates to which [Data] column in the SetupBatcher script the field is copied to. As you can see, columns 1-7 are used for the fields from the first page and columns 10-19 are used for fields from the page labeled extra.

This is what happens when an account is created

1.The selected script is loaded in the SetupBatcher editor  
2.Data from the fields in the dialog is copied to corresponding columns in the [Data] section of the SetupBatcher script  
3.The [Batch] section of the script is executed  

When finished the script will remain loaded in the SetupBatcher editor complete with dialog parameters for you to examine. If there are problems you should always look for error messages in the log window right below the script editor.

Creating a script is really just a matter of selecting appropriate commands and feeding them with data from available columns. Read the SetupBatcher manual to learn more. Just remember to avoid using any of the columns occupied with data from the dialog for markers (the BatchSettings.MarkerCol setting should be set to 8, 9 or 20 or higher).

But wait, one more thing, how does the script know in which container to create accounts? It is simple. When creating an account you right-click an existing account in the desired target container and select "Create", the selected container is then converted into a full container path that can be accessed in SetupBatcher through the xDPath variable.

SetupBatcher variables used to transfer parameters from xD buttons new account dialog
Variable
Description
xDAccountExpires
[from script] Displayed in the "Account Expires" field in the new account dialog.

[to script] Use in script to get value from the "Account Expires" field in the new account dialog.
xDPath
[to script] Contains full path to container in which to create account

Notice: Linux requires a Lin.DS.Logon command in the script before accessing the directory server.
xDMachine
[to script] Linux only: LDAP server (from Linux button dialog) to use for Lin.DS.Logon command.
xDAccount
[to script] Linux only: LDAP admin superuser account (from Linux button dialog) to use for Lin.DS.Logon command.
xDPassword
[to script] Linux only: LDAP admin superuser password (from Linux button dialog) to use for Lin.DS.Logon command.


Tip: use the "script wizard" button in SetupBatcher to get started with Windows server AD scripts.

How to set up the input fields

Besides the above table there are two more variables in the script, xD.MandatoryFields that decides if fields on the main page that are mandatory or not, and xD.UserDefFields that completely controls the fields on the extra page.

The xD.MandatoryFields variable is a seven character long string, one character for each field on the main page, that contains a dollar ("$") character if a field is mandatory or a blank character if a field can be left empty. However, position 5 and 6 in the variable is always ignored - account name and password are always mandatory. Whether a field is mandatory or not is indicated with an asterisk ("*") character after the field name in the dialog.

xD.UserDefFields is a bit more complex, it contains one definition string for each field on the extra page, 10 fields in total. Each definition string ends with the paragraph ("§") character. The definition string contains the label for a field shown in the dialog or a zero ("0") character if a field is to be hidden. There are also two more control characters for xD.UserDefFields we need to mention:

A dollar ("$") character before a label definition means that it cannot be left blank - indicated with an asterisk ("*") character in the dialog label - when clicking "OK" SetupExplorer will keep asking until something is entered in the field.

An ampersand ("&") character before a character in the label definition sets the field hot key - example 1: "&phone" shows "phone", press alt+p to jump to the field, example 2: "ph&one" shows "phone", press alt+o to jump to the filed.

Example - the above "New Novell account in OU3" dialog "Extra" tab has a field definition that looks like this:

xD.UserDefFields=&Street:§&Zip:§&City:§0§0§0§$Home &Phone:§0§0§0§

Delete accounts

·Click a single account or click and drag with the mouse to select a range of accounts, then right click and select "Delete" in the popup menu. The delete accounts dialog is now displayed.  



·As you can see, number of accounts to delete and first and last account is displayed right below the middle of the dialog.  
·Select the "Delete" radiobutton to simply delete the selected accounts.  
·Select the "Run SetupBatcher [Undo] section" radiobutton to run the [Undo] section of the selected script. Click "Change" to change script. Notice that when a new script is selected for an OS in the new account dialog it is also changed for the same OS in the delete account dialog and vice versa, this is in order to always use [Batch] and [Undo] sections from the same script.  

The idea with the [Undo] section is that you can "Undo" everything that was done in the create account dialog [Batch] section, for instance if you created accounts, directories and shares in the [Batch] section you can delete accounts, directories and shares in the [Undo] section.