ammounpierre
asked on
Create Users & mailboxes automatically under win2008 R2 & Exchange 2010
Hello Gurus
I have a win2008 R2 domain controller. I also have another member server which has Exchange 2010.
I have to create 124 Users in 1 specific OU with their mailboxes in Exchange 2010.
I need to set the following settings.
1-User Name & Surname
2-Password ("letmein" for all) - They need to change it on next logon
3-Start up script (some mappings...)
4-Home Folders
5-Enable a Mailbox for those users
I also have a GPO that I need to use for those users.
In fact I have 10 users created and working perfectly as I need the other 124 .
Is there a way to "extract" the settings from those users into a "template" that I could modify to apply on the ones I need to create ?
How Do I do this is Powershell ?
Thanks
I have a win2008 R2 domain controller. I also have another member server which has Exchange 2010.
I have to create 124 Users in 1 specific OU with their mailboxes in Exchange 2010.
I need to set the following settings.
1-User Name & Surname
2-Password ("letmein" for all) - They need to change it on next logon
3-Start up script (some mappings...)
4-Home Folders
5-Enable a Mailbox for those users
I also have a GPO that I need to use for those users.
In fact I have 10 users created and working perfectly as I need the other 124 .
Is there a way to "extract" the settings from those users into a "template" that I could modify to apply on the ones I need to create ?
How Do I do this is Powershell ?
Thanks
ASKER
I created a file called toadd.ps1 and entered the following in it.
$users = Import-CSV C:\scripts\users.csv
$users| foreach
{
$Password = convertto-securestring $_.password -asplaintext -force
new-mailbox -name $_.name -alias $_.alias -FirstName $_.Firstname -LastName $_.Lastname -userPrincipalName $_.UPN -database $_.Database -OrganizationalUnit $_.OUpath -Password $Password –ResetPasswordOnNextLogon: $true
}
************************** **
Then I created a CSV file and tried to run the command in PS.
Not working !
$users = Import-CSV C:\scripts\users.csv
$users| foreach
{
$Password = convertto-securestring $_.password -asplaintext -force
new-mailbox -name $_.name -alias $_.alias -FirstName $_.Firstname -LastName $_.Lastname -userPrincipalName $_.UPN -database $_.Database -OrganizationalUnit $_.OUpath -Password $Password –ResetPasswordOnNextLogon:
}
**************************
Then I created a CSV file and tried to run the command in PS.
Not working !
Are you running the script in Exchange Management Shell? if yes what is the error?
Only problem I see is with the use of foreach, you didn't start the Curly bracket immediately after foreach command..
Try this..
Try this..
$users = Import-CSV C:\scripts\users.csv
$users| foreach {
$Password = convertto-securestring $_.password -asplaintext -force
new-mailbox -name $_.name -alias $_.alias -FirstName $_.Firstname -LastName $_.Lastname -userPrincipalName $_.UPN -database $_.Database -OrganizationalUnit $_.OUpath -Password $Password –ResetPasswordOnNextLogon:$true
}
ASKER
This is the error I am getting while inputing the lines one by one in PS
error.png
error.png
You are running the script in normal PowerShell, you need to run the script in Exchange Management Shell.. Also can you post the input csv file? I think you have not provided the tab password in the file or its values are empty..
To open the Exchange Management Shell, follow these steps:
1.Click Start, point to All Programs, and then point to Microsoft Exchange Server 2010.
2.Click Exchange Management Shell.
To open the Exchange Management Shell, follow these steps:
1.Click Start, point to All Programs, and then point to Microsoft Exchange Server 2010.
2.Click Exchange Management Shell.
ASKER
ASKER
At last it works !
Thanks a lot !
Still few things...
I would like to add
1-a logon script (scriptstart.bat)
2-Home Folder Z:\ connect to \\data-srv\users\%Username %
Thanks again !!
Thanks a lot !
Still few things...
I would like to add
1-a logon script (scriptstart.bat)
2-Home Folder Z:\ connect to \\data-srv\users\%Username
Thanks again !!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
www.youtube.com/watch?v=nvJSMdnyeIQ
http://searchexchange.techtarget.com/tip/Create-hundreds-of-Exchange-2010-mailboxes-for-real-world-lab-testing
http://itproafrica.com/technology/exchange/using-powershell-to-bulk-create-exchange-users-with-passwords/