Forum Discussion

Anonymous's avatar
Anonymous
Jul 28, 2016
Solved

Script to add multiple proxy addresses to Mailbox

Hello Folks   any body has script handy? which would add multiple proxy addresses to Remote mailbox?   I looked over net but couldnot get relevant one.   Kindly please advice.
  • Maor Bracha's avatar
    Jul 28, 2016
    If you work with DirSync and Exchange online, here's what you can do:

    1. Create a CSV containing two columns- SamAccountName and ProxyAddresses (seperated in commas, in the format "smtp:address@domain")

    2. On PowerShell import the active directory cmdlet by using "import-module active*"

    3. Import CSV to a variable
    $CSV=import-csv csvpath.csv

    4. Following block will loop through users and addresses to add them

    Foreach($User in $CSV)
    {
    Foreach($Address in $User.ProxyAddresses){Set-AdUser $User.SamAccountName -Add @{ProxyAddresses=$Address}}
    }


    5. Run a sync cycle to replicate into Office 365.

    According to your other thread here you work with standalone Exchange online. If that's the case you can change the SamAccountName with mailbox alias and instead of "Set-AdUser" use "Set-Mailbox" on Exchange online shell.

    Hope this helps. Feel free to let me know if you require any further assistance.

    Maor Bracha

Resources