# Imports users into Active Directory from a CSV file. Use UsersTemplate.CSV as a guide to the formatting. $inputFile = Import-CSV "users.csv" $ou = Read-Host "Org Unit (Format: OU=NewCompany,DC=Domain,DC=com)" foreach($line in $inputFile) { $fn = $line.FirstName $ln = $line.LastName $displayName = $fn + " " + $ln $dn = "CN=" + $displayName + "," + "$ou" $userName = $line.UserName $password = $line.Password $email = $line.EMail dsadd user "$dn" -samid $userName -pwd $password -fn $fn -ln $ln -email $email -mustchpwd No -pwdneverexpires Yes }