Thursday, September 19, 2013

How to add the list of email addresses to the single mailbox


If you have a txt file with the email addresses to add to the single mailbox you can run following PS script in MS Exchange Management Shell (Exchange 2010 - should work on Exchange 2007 too):
1. $a = Get-Content c:\emailaddresses.txt
(this get content of emailaddresses.txt file with email addresses in it to the variable $a, which is the array)
2. foreach ($b in $a) {set-mailbox user1@yourdomain.com -emailaddresses @{Add=$b} }
(as you see, it's a cycle, where it picks up an item out of array $a to the variable $b and for every item in the array $a, command adds it to the mailbox user1@yourdomain.com)

No comments:

Post a Comment