Powershell – Importing users to AD with CSV, cannot get some fields to work

active-directorycsvpowershell

Been trying to build a CSV file to import users into Active Directory. I can get everything to populate, except for E-mail, Password, and Enabling the user. Just using this cmdlet in Powershell.

Import-CSV "C:\Users\Administrator\Downloads\adimport.csv" | new-ADUser

This is what my CSV looks like.

CSV File

For some reason the E-Mail field in the General tab won't fill. I'm also not sure what column header to use to enable the profile, and I think password is userPassword, right?

Is there something i'm doing wrong that the E-Mail field won't fill in?

Best Answer

Try rename field in csv from mail to EmailAddress

New-ADUser accepts a property of EmailAddress, but not mail. Some of these correspond to an AD attribute, but not all.

New-ADUser
https://technet.microsoft.com/en-us/library/ee617253.aspx