How to import Active Directory users using PowerShell
This article explains the procedure to import users to Active Directory (AD) from a CSV file, using PowerShell and ADManager Plus, a unified Active Directory, Office 365 and Exchange management and reporting solution. This article also explains how ADManager Plus' purpose-built task templates turns importing AD users from a CSV file, in bulk, a simple mouse-clicks based operation.
Steps to import users to AD.
- Ensure you have the necessary permissions to perform this action, and also to execute PowerShell scripts in the required domain.
- Create the CSV file with the list of all users to be imported to AD, with the LDAP names of the necessary attributes as the header.
- Identity the domain and the OU to which the users have to be imported.
- Create the script using the Add-ADGroupMember cmdlet, and execute it in the PowerShell window.
A sample PowerShell script to import users to ad group
Click to copy entire script
ForEach ($User in $NewUsersList)
New-ADUser -Name $givenName -GivenName $givenName -SamAccountName $sAMAccountName
To import AD users,
- Click Create Users feature located under CSV Import in User Management, located in Management tab.
- Select the desired domain, and template, click Import and select the relevant CSV file, select the desired OU and Click Create Users.
In fact, almost all AD, Office 365, Exchange management features have CSV import option built-into them, allowing you to manage the objects in single or bulk easily, using the same feature, with just mouse clicks.
» Start 30-day Free Trial
Limitations of using PowerShell to import users to AD
- You will not be able to import AD users and add them to AD using PowerShell if you do not have sufficient permissions in AD. With ADManager Plus, users privileges in native AD or Exchange doesn't have to be elevated to add user to AD groups.
- Using PowerShell to import users will need you to create complex scripts based on your needs. ADManager Plus on the other hand offers CSV import as a built-in option in all its management features, allowing you to import users list from CSV, with just point and click actions.
- You must know how to execute the scripts from the PowerShell window. With ADManager Plus, all management and reporting operations can be performed from an intuitive GUI with just mouse-clicks based actions.
- A misplaced hyphen, a typo in the LDAP names or lack of sufficient permission to configure even just one of the attributes used in the script will lead to errors. As ADManager Plus is completely GUI-driven, there is no need to depend on scripts, eliminating the chances of errors.