Monday, April 28, 2008

Automating Active Directory User Creation

I have been learning to use Powershell over the past few months. Every script I write, I write in Powershell so I can improve my skills. It has become aparent to me that the name is very appropriate. With very simple commands that even a (gasp) non-programmer can do, you can automate just about anything. Today, I automated a way to create users in Active Directory. The script (if I can call it that since it could all be done from one line) pulls in a CSV file that has been prepopulated with users, assigns the fields to AD attributes, and creates the users. It can put them in different OUs, assign an expiration date, and much more.

I did not tackle every user property, just what I thought was important for our organization. I'll probably even add a couple fields for us. The point, however, is that this is a more robust and fully-functional example of how to add multiple users to the domain easily. From here you could set up a script to pull information from your HR system and either dump it into the CSV file for processing or have it run the import directly.

Here is a link to the script.

No comments: