Import users from CSV file into Active Directory – the easy way

OK, this is a task that probably everyone been faced with… Kinda boring.. There’s a lot of ways and tools to do it: ldifde, csvde, powershell, vbscript…

However my favorite is this one-liner with the help of Joe’s admod tool:

admod -csv -add -import -unsafe -cont < .\UserImport.csv

(unsafe to import a lot of objects, cont to continue importing if an entry fails)

It will create disabled users, with blank password, and change password at first logon attribute set. It seems the fastest and easiest method (thanks to Tomek for pointing this out to me).

Your CSV just needs to have DN as the first value. If you are wondering what attributes to add to the file, there’s a ton…

My sample is:

dn,objectClass,sAMAccountName,sn,givenName,userPrincipalName,name,displayName,initials,Description,company,telephoneNumber,mobile,physicalDeliveryOfficeName,department,title,facsimileTelephoneNumber,EmployeeID,EmployeeNumber,Manager,c,co

Oh, and if you are adding manager attribute, of course you need to make sure the manager account is on the list before the “managed” person.

If you are wondering what else to add, whole list of attributes for your reference is attached here.

If you want to modify your users after that use Tomek’s tip with adfind, admod combination.

About these ads

~ by alipka on October 19, 2009.

4 Responses to “Import users from CSV file into Active Directory – the easy way”

  1. I am trying to create a CSV file of about 500 email addresses i have them in an Excel spreadsheet. These are external addresses that I want to import in my Contacts OU. What steps would i need to create this CSV file successfully. Thanks!

  2. You can use the same method as above, just specify a bit different CSV format for example:
    dn,objectClass,mail,displayName

    And provide “contact” as objectClass.

    Otherwise you can use other solutions out there, e.g.: http://www.highorbit.co.uk/?p=377.

  3. Hi,
    While try to run the above command , i am gettings this message and nothing is imported

    DN: CN= abc , OU=students ,DC=haxtun2k,DC=domain…: [server1.hello.com] Error 0x15 (21) – Invalid Syntax

    please help

    Thanks

  4. Hey Guys , I am completely new to AD and nowadays I have to add almost 600 new users details to AD from the excel sheet. Please let me know the shortcut of doing this or anyways to automate it so that this tedious work becomes simpler. Thanks .(I request you guys to elaborate the steps as I am new to AD)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: