Bulk AD Users – Bulk Modify

BulkADUsers - Bulk Modify
Bulk Modify dialog

Overview

The Bulk Modify dialog is a simple way to update user account attributes for a large number of user accounts.  The Bulk Modify method is appropriate where you want to update all users to have the same attribute value, or the attribute value can be based on other existing attributes.  For example, you might want to change the logon hours for selected user accounts to prevent them from logging in out of hours.  You might want to force all users to change their password at next logon, or add all users in the “Accounting” ou to the “Accounting” group.  The ability to base updates on existing attributes also allows you to change the display name format to “surname, firstname” or to update your username format to “firstname.surname”.  A large number of other update scenarios are also supported.  For updates that require a different value for each user account and the update can’t be based on existing data, you might want to consider the CSV Update or the Edit In Excel feature. (E.g. Data from your HR database like firstname, surname etc)

Getting Started

After selecting the user accounts you want to modify, launch the Bulk Modify dialog by selecting the Bulk Modify button on the toolbar.

The Bulk Modify dialog (pictured at the top of the page) will be displayed.  The dialog has been designed to look similar to the user dialog in Active Directory Users and Computers – this will make it easier for you to find the attributes you want to modify as the user interface is already familiar to you.

You will find that the textboxes that you normally use to enter information are disabled in the “Bulk Modify” user interface.  If you want to modify an attribute you will need to select the checkbox located to the left of the textbox.  Once the checkbox has been checked you will be able to enter data into the textbox – this also provides a signal to the application that the attribute selected is to be modified.  Most checkboxes also have an intermediate state (The checkbox is checked but also greyed out) that is used to clear the attribute. If you enter a zero length string into the textbox this will not clear the attribute and normally results in a failed attribute modification.

Once you have specified the required updates, click the “Update” button to apply your changes.  After the application has finished applying updates to Active Directory, the Bulk Modify Results dialog is displayed to show the success/failure of the update. You can view the details of the update and rollback the update if required. 

XML Placeholders

The ability to modify attributes in bulk would be of limited use without some additional intelligence.  For example, you might want to specify that the Display Name attribute is set to “Surname, Firstname” or specify the user profile path to be “\\server\share\username”.  This is where XML Placeholders come in.  XML Placeholders allow you to do all of the above plus text find and replacement and other forms of string manipulation.  Some common options are automatically entered for you by various hyperlinks in the application. In the Bulk Modify dialog pictured at the top of the page, the “Surname, Firstname” hyperlink next to the “Display Name” attribute was clicked to insert the required XML placeholders into the “Display Name” textbox.

If you want to set a single value for all user accounts, the XML placeholders feature can be ignored – just enter the value required in the textbox.  To base an update on existing attribute you will include placeholders that will be substituted for an existing attribute value when the update is performed.  The placeholders are specially formatted in XML tags to allow the application to recognise that the text is to be replaced with an existing attribute value.  The name of the attribute is inserted between “” and “”, like the value specified in the Bulk Modify dialog shown at the top of the page:

<attr>sn</attr>, <attr>givenName</attr>

The part “sn” will be replaced by the “sn” (surname) attribute, the “, ” part remains unchanged and the”givenName” part is replaced by the “givenName” (first name) attribute.  The new value would look something like “Wiseman, David” or “Doe, John”.

XML Placeholder Examples

The easiest way to learn what you can do with XML placeholders is probably through a series of examples provided below:

FirstName.Surname

 <attr>givenName</attr>.<attr>sn</attr>

Surname, FirstName:

<attr>sn</attr>, <attr>givenName</attr>

Convert company name to UPPERCASE:

<attr transform=”UPPER”>company</attr>

Convert display name to lowercase:

<attr transform=”LOWER”>displayName</attr>

Convert display name to Proper Case:

<attr transform=”PROPERCASE”>displayName</attr>

Replace “WiseSoft” with “WiseSoft Corporation”:

<attr findtext=”WiseSoft” replacewith=”WiseSoft Corporation”>company</attr>

Remove whitespace from description attribute:

From start and end:

<attr transform=”TRIM”>description</attr>

From end only:

<attr transform=”RTRIM”>description</attr>

From start only:

<attr transform=”LTRIM”>description</attr>

First Letter of FirstName + Surname:

<attr transform=”LEFT(1)”>givenName</attr><attr>sn</attr>

Last 4 characters of Telephone Number (Extension?):

<attr transform=”RIGHT(4)”>telephoneNumber</attr>

3rd and 4th character of EmployeeID

SUBSTIRNG(start,length)

<attr transform=”SUBSTRING(3,2)”>employeeID</attr>

Convert first letter of First Name to Uppercase

<attr transform=”LEFT(1)” transform2=”UPPER”>givenName</attr><attr transform=”SUBSTRING(1,*)”>givenName</attr>

NULL attribute values

XML Placeholders will generate a validation error by default if the attribute specified does not have a value.  The application will not attempt to modify the value.  You can change this behaviour by specifying a “nullvalue” attribute in the XML Placeholder.  If the attribute does not have a value, the text specified for “nullvalue” will be used.

The following example will replace any null values for the surname (sn) attribute with a blank string.

<attr nullvalue=””>sn</attr>, <attr>givenName</attr>

If the surname didn’t have a value but the first name was set to “David”, the placeholder above would produce “, David”.  You might just want to use the value of the first name attribute where the surname attribute is null.  You can do this by specifying the “, ” as a postfixtext attribute in the XML placeholder.  e.g.

<attr nullvalue=”” postfixtext=”, “>sn</attr><attr nullvalue=””>givenName</attr>

The prefixtext and postfixtext attributes are ignored when the attribute has a null value.