Wednesday, November 27, 2013

How to import user accounts

You are an administrator of a large university, and you have got a CSV file with all the information of new students next year. You need to create all users in AD four weeks before term starts, how you would do?

The file (students.csv) is like below -

name,sAMAccountName,GivenName,Surname
John Woods,john.woods,Johnathan,Woods
Kim Akers,kim.akers,Kimberly,Akers

PS C:\> import-csv ./students.csv | new-aduser -Path "OU=Students,OU=User Accounts,DC=contoso,DC=com" -AccountPassword (ConvertTo-SecureString -AsPlainText "********" -Force)

Students created and disabled for the moment.

You forget to add University property, then you need to -
PS C:\> dsquery user "OU=Students,OU=User Accounts,DC=contoso,DC=com" | dsmod user -company "XXX Univerisity"

No comments:

Post a Comment