Update Multiple Entries (Replace value and Update) (LDAP And Active Directory)

Home | Tutorials | Compare

1. Replace a specific value for all enteries in a container.

If you want to replace a value (description='test') of all enteries in a container (ou=People,dc=test,dc=com) with a new value (description='New Value') run a statement like following:

UPDATEREPLACE ou=People,dc=test,dc=com set description='New Value' where description='test'


2. Replace values using export and import

If you want to update values of multiple entries with new values (different values for every entry), first export out the container as update statements, the update statement will provide a template file where you modify the values and import using sql import.

The following example illustrates modifying description attribute of all entries in container ou=People,dc=test,dc=com. As attributes can have multiple values make sure to only modify the values you want to change and keep the values you don't want to change in the file.

To export all entries in a container, first select a container and from right click context menu, select Export


update replace multiple ldap values


Browse and select a location for the update file and click on the browse button adjacent to returning attributes drop down.



On the attributes dialog, type in the filter text field to filter the values, select 'description' attribute and click ok



When you click OK, the attribute dialog will close and will populate the description attribute in the returning attributes field. If you want to modify multiple attributes, select additional attributes before clicking ok. Also set the count limit to '0' to retrieve all records. Now Click 'Finish' on the export update statement dialog.



After the export is completed, click on 'Open File' to open the sql file for modification



The open file button will open the file using your system text editor. It is better to open the file using a text editor other then notepad (like TextPad) for easy modifications. Here is the view of the file using TextPad.



Modify the attribute value as show below and save the file.



Now we are going to import the file to update the values (Please make sure to test in test environment first). To import file select Import|SQL from the main menu.



On the Import dialog, select the correct update file, if correct one is not selected automatically. Now click on the 'Start Importing' button to update the values.



After the records are imported you will see the status on the update dialog.



Now you should see the new updated value when you select one of the updated entry (if the update process was successful).



See Also:

Query Active Directory using Select Statements
Update Active Directory entries using where clause