![]() |
|
|
| Become a Columnist Microsoft Exchange Site Microsoft Support SiteMSDN Exchange Site | ||
|
|
CSVDE Output These gives us a .CSV with the first column reference of DN. Open this file in Excel, copy and paste the column into Notepad, and remove the extra comma’s after each line. Then remove the first line which only contains the word “DN”. The DN or distinguished name is the unique reference of an AD object, for example, the first few entries of our text file might look like this: CN=Mate Dobos,OU=Budapest,DC=hu,DC=acme,DC=com CN=Andras Barna,OU=Budapest,DC=hu,DC= acme,DC=com CN=Andrea Bodnar,OU=Budapest,DC=hu,DC= acme,DC=com Save this file as Users.txt. This will be the input file for our script. Here’s a link to a ZIP file with a sample users.txt and the bulk_update.vbs script file. The code is reasonable well documented and is meant to get you off the ground quickly. The error handling is “brief”. I have commented out four lines at the end, which will provide slightly better error descriptions. Lets have a quick look at the main code: Here we're setting user attributes, which correspond to the column heading in our CSV file. TIP: If you don’t know the AD reference or name of a particular field, then fill in the field in the AD admin tool, export it and look up the heading in the CSV. E.G. the “office” field displayed in AD Users and Computers is called the “PhysicalDeliveryOfficeName” user attribute. objUser.description = "Converted to D2K - 23/02/2002" objuser.physicalDeliveryOfficeName = "Budapest" objuser.telephoneNumber = "1375" objuser.department = "Budapest" objuser.setPassword("ACME") 'allways a usefull one to be able to do in script :) objUser.SetInfo These are all rather standard, except for the last two lines, which call the setpassword and setinfo methods for the user object. Setinfo commits the information entered from memory into AD. You are able to change most fields in this manner, excepting for non-string fields, such as the proxyaddresses attribute. This requires extra considerations, as it is an array, but I’ll talk about this in a future article. Where do we go from here? This article is meant to provide a bit of help starting off making bulk changes to your AD without having to use LDIFDE, which I found more cumbersome than helpful. Taking the time to understand a bit of LDAP will take you far in editing and changing existing object attributes. This script may be adapted to deal with any object, but in our context aims specifically towards making our lives as administrators, just that little bit easier. Updating Active Directory for the Exchange 2000 Administrator
| |||||||
Disclaimer: Your use of the information contained in these pages is at your sole risk. All information on these pages is provided "as is", without any warranty, whether express or implied, of its accuracy, completeness, fitness for a particular purpose, title or non-infringement, and none of the third-party products or information mentioned in the work are authored, recommended, supported or guaranteed by Stephen Bryant or Pro Exchange. OutlookExchange.Com, Stephen Bryant and Pro Exchange shall not be liable for any damages you may sustain by using this information, whether direct, indirect, special, incidental or consequential, even if it has been advised of the possibility of such damages.
Copyright Stephen Bryant 2008