E2010: Add/Remove email id for bulk users
Three step solution to add or remove multiple email addresses
1. Create Name.ps1 – This will have following 5 line cmds mentioned
————————————————————————————————————————
Import-Csv c:tempdata.csv | Foreach{
$maileg = Get-Mailbox -Identity $_.Name
$maileg.EmailAddresses += $_.email -split ‘;’
$maileg | Set-Mailbox -EmailAddresses $maileg.EmailAddresses
}
————————————————————————————————————————
There are 2 parameters which can be changed in it.
1. Name of the csv file.
2. In line no 3 use + for adding the email id and – for removing the email id.
Add
Import-Csv c:tempdata.csv | Foreach{
$maileg = Get-Mailbox -Identity $_.Name
$maileg.EmailAddresses += $_.email -split ‘;’
$maileg | Set-Mailbox -EmailAddresses $maileg.EmailAddresses
}
Remove
Import-Csv c:tempdata.csv | Foreach{
$maileg = Get-Mailbox -Identity $_.Name
$maileg.EmailAddresses -= $_.email -split ‘;’
$maileg | Set-Mailbox -EmailAddresses $maileg.EmailAddresses
}
2. Create data.csv – This file will have name and email id of the users. See example.
Name,email
pn,smtp:pn@pn.com;SMTP:Prabhat@pn.com
3. Run the ps1 file from the exchange powershell and done.
C:temp>Name.ps1
Prabhat Nigam
Team@MSExchangeGuru
May 3rd, 2012 at 6:16 pm
I have searched high and low and can not find a delete bulk mailbox with powershell example. I have been trying to put it together from several other examples but no luck do far. Here is a sample of what I have tried:
[PS] C:\>$mb = Get-Mailbox -Database qt-mbx-cls.oberonmedia.local\china | select
Alias | Remove-Mailbox -Identity Alias -Permanent $true -Confirm:$false -whatif
I have also tried various foreach loops, but just get errors
Any help is greatly appreciated!
May 4th, 2012 at 5:19 pm
Answer here: http://randomtechminutia.wordpress.com/2012/05/03/powershell-script-to-delete-exchange-mailboxes-in-mass/
June 8th, 2012 at 4:20 pm
This is a tested PS.1 script so it can’t be wrong.
I will be interested in checking your errors.
June 28th, 2012 at 2:41 am
Thank you for this fix.