This PowerShell scripts shows how to create user accounts that are located in a .csv file and move it to a specified OU.
You can add lots of attributes to the New-ADUser cmdlet for example: –mail –manager –mobile etc.
I created a users.csv file before I executed this script:
|# Created by Maarten Peeters
# Created this script using Windows Server 2012# Import Active Directory module
Import-Module ActiveDirectory -ErrorAction SilentlyContinue# Set OU for the user accounts
$OU = “OU=Users,OU=Domain environment,DC=peet,DC=local”
# Get domain name
# Import the file with the users.
foreach ($user in $users)
# Get password from CSV File
# Create Accounts
$FullName = ($user.FirstName + ” ” + $user.LastName)