Hey everyone, I am on a project that is requiring me to create a 1000 AD accounts. I have a csv file that is already populated with the names. There are two columns, FirstName and LastName. Can someone please provide a powershell script that can create the users. I know how to edit the script to meet my domain, OU , password etc.
Thanks for the scripts guys, @ Rajkumar-MCITP, I did not try your script because I do not want to create any mailboxes, if you edit it to not create mailboxes, then I will. @ Misidia, I tried yours but it generated errors as shown in the attached screenshot. I aklo attached your script to show what changes I made. I left my csv file with the same two original columns, FirstName and LastName. powershell-error.png Users.txt
Thanks Rajkumar-MCITP but it really does not, but just so I get a better understanding:
Is the first section defining what columns are expected to be in the csv file? With that being said, if those columns are not there, will the script just use the ones there? In my case, I only have two colums, FirstName, and LastName.
CSV...
Name,Password,Description,OU,TSPath
Test001,Metro123,Ellipse Regression Testing account,"OU=NewUsers,OU=Testing,OU=Users,OU=Company,DC=local",\\company.local\data\Profiles-L-Z\Test001
**********************************
Where in here do I define what the password is?
Again, thanks for your help. I assume this would mean that users will be required to change password at next logon, hence no parameter for -changepassowordatlogon. I will test and note results
name, alias, UserPN, password
Username1, Aliasname1, username1@domainname.com, yourpassword
save the file in c drive or ur wish and then run this shell command
import-csv c:\newusers.csv | foreach {New-Mailbox -Name $_.name -Alias $_.alias -UserPrincipalName $_.UserPN -Database “Your mailbox database name” -Org Users -ResetpasswordonNextlogon $true -Password (ConvertTo-SecureString $_.password -AsPlainText -Force)}