SOLVED
Home

Script to add multiple proxy addresses to Mailbox

%3CLINGO-SUB%20id%3D%22lingo-sub-3649%22%20slang%3D%22en-US%22%3EScript%20to%20add%20multiple%20proxy%20addresses%20to%20Mailbox%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3649%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20Folks%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eany%20body%20has%20script%20handy%3F%20which%20would%20add%20multiple%20proxy%20addresses%20to%20%3CSTRONG%3ERemote%20mailbox%3C%2FSTRONG%3E%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20looked%20over%20net%20but%20couldnot%20get%20relevant%20one.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EKindly%20please%20advice.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3649%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExchange%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3655%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20add%20multiple%20proxy%20addresses%20to%20Mailbox%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3655%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20Buddy.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ELet%20me%20try%20and%20come%20back%20to%20you.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3651%22%20slang%3D%22en-US%22%3ERe%3A%20Script%20to%20add%20multiple%20proxy%20addresses%20to%20Mailbox%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3651%22%20slang%3D%22en-US%22%3EIf%20you%20work%20with%20DirSync%20and%20Exchange%20online%2C%20here's%20what%20you%20can%20do%3A%3CBR%20%2F%3E%3CBR%20%2F%3E1.%20Create%20a%20CSV%20containing%20two%20columns-%20SamAccountName%20and%20ProxyAddresses%20(seperated%20in%20commas%2C%20in%20the%20format%20%22smtp%3Aaddress%40domain%22)%3CBR%20%2F%3E%3CBR%20%2F%3E2.%20On%20PowerShell%20import%20the%20active%20directory%20cmdlet%20by%20using%20%22import-module%20active*%22%3CBR%20%2F%3E%3CBR%20%2F%3E3.%20Import%20CSV%20to%20a%20variable%3CBR%20%2F%3E%24CSV%3Dimport-csv%20csvpath.csv%3CBR%20%2F%3E%3CBR%20%2F%3E4.%20Following%20block%20will%20loop%20through%20users%20and%20addresses%20to%20add%20them%3CBR%20%2F%3E%3CBR%20%2F%3EForeach(%24User%20in%20%24CSV)%3CBR%20%2F%3E%7B%3CBR%20%2F%3EForeach(%24Address%20in%20%24User.ProxyAddresses)%7BSet-AdUser%20%24User.SamAccountName%20-Add%20%40%7BProxyAddresses%3D%24Address%7D%7D%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E5.%20Run%20a%20sync%20cycle%20to%20replicate%20into%20Office%20365.%3CBR%20%2F%3E%3CBR%20%2F%3EAccording%20to%20your%20other%20thread%20here%20you%20work%20with%20standalone%20Exchange%20online.%20If%20that's%20the%20case%20you%20can%20change%20the%20SamAccountName%20with%20mailbox%20alias%20and%20instead%20of%20%22Set-AdUser%22%20use%20%22Set-Mailbox%22%20on%20Exchange%20online%20shell.%3CBR%20%2F%3E%3CBR%20%2F%3EHope%20this%20helps.%20Feel%20free%20to%20let%20me%20know%20if%20you%20require%20any%20further%20assistance.%3CBR%20%2F%3E%3CBR%20%2F%3EMaor%20Bracha%3C%2FLINGO-BODY%3E
Deleted
Not applicable

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.

2 Replies
Solution
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

Thanks Buddy.

 

Let me try and come back to you.

Related Conversations