Easily Add Users to Active Directory with PowerShell
Easily add users to Active Directory with Windows PowerShell.
Adding new users to Active Directory (AD) is one of the most common management tasks in any organization. When performed manually, it can also be one of the most time-consuming, especially for organizations that take the time to populate the directory’s many attributes, such as department, job title, and so forth. Manually adding users can be a potentially major time expense. For example, taking five minutes to create a new user might not seem all that bad – until you multiply that by hundreds of users! Windows PowerShell can offer an effective way to quickly create new users in much less time, and can do so without lengthy or complicated scripting or programming.
Information on new users will commonly originate in the organization’s Personnel or Human Resources department. There are a variety of ways in which that information might be communicated to the IT department: Excel spreadsheets, personnel management databases, and so forth. For this example, assume that you’re getting the information in a Comma-Separated Values, or CSV, file.
A CSV file is pretty easy to create from a database export, from an Excel spreadsheet, and so forth. Ideally, you’ll want the first line of the CSV file to contain column headers, and you’ll want those column headers to align to the attribute names used by Active Directory. Specifically, you’ll want to provide column headers that match the parameter names of the New-ADUser cmdlet, keeping in mind that the parameter names are sometimes slightly different from the underlying directory schema attributes.
For example, in the directory, “L” is the attribute where a user’s city, or locality, is stored. The New-ADUser cmdlet accesses this via the –city parameter, which can be a bit easier to read and remember. You can find a complete list of available parameter names at http://technet.microsoft.com/en-us/library/ee617253.aspx.
Here’s what your CSV file might look like:
Simply add a new row for each new user. You can of course have additional columns, provided each column is named the same as a parameter of New-ADUser.
Don Jones is a Senior Partner and Principal Technologist for Concentrated Technology, LLC, an IT consulting and analysis firm. He’s the author of more than 35 books.