Link to home
Start Free TrialLog in
Avatar of teomcam
teomcam

asked on

Adding bulk emails addresses in 2008 R2 Active Directory

One of my OU contains around 1000 users who don't have exchnage email accounts. Due to lack of hardware and bandwith we are using exchnage for only 1 OU's users which they are Staff.
We have another domain name and created email accounts on Google Mail.

My question is how can I add the new external emails into the users email field.
Note: I don't wanna use Google AD Sync
Please find the sample csv file that we have for all new users.


users.csv
Avatar of Rajitha Chimmani
Rajitha Chimmani
Flag of United States of America image

You may use the below lines of code to add additional email address to the existing Exchange mailbox.

Change the heading of second column to EmailAddress

foreach($user in import-csv users.csv){

$Emailaddresses = (Get-Mailbox -Identity $user.Samaaccountname).emailaddresses
$ExtAddr = "smtp:"+$User.EmailAddress
$Emailaddresses.Add($ExtAddr)
Set-Mailbox -Identity $user.Samaccountname -Emailaddresses $Emailaddresses
}

Note: Test this with a test mailbox first before proceeding with actual user mailboxes
Alternate command

Import-CSV "users.csv" | ForEach {Set-Mailbox $_.samaccountname -EmailAddresses @{add=$_.Emailaddress}}


Ref: http://technet.microsoft.com/en-us/library/bb123794.aspx
Are you trying to mail enable the users? or just want to add the email address in general tab of account? Also which version of exchange are you using?
Avatar of teomcam
teomcam

ASKER

I Just wanna add the email address in General Tab of the account. I am using Exchange 2010 SP2
ASKER CERTIFIED SOLUTION
Avatar of SubSun
SubSun
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of teomcam

ASKER

I will try it asap and will get back to you.
Thanks
Have you tried the one I gave you?
Avatar of teomcam

ASKER

No I don't think yours is a suitbale solution to my scenario. I just wanna add emails into the general tab of the people who don't have email address from our exchange server. I cannot accomodate any mailbox for that much users in the exchnage server.