Just in case it wasn’t clear, start with mailboxes.txt. It includes (as a 
sample) the following lines:

Name,ForwardingAddress
george,george-at-gm...@gmail.com
andy,andy-at-...@aol.com
michael,mich...@smithcons.com

Then, import the CSV file and process it, as shown by example:

      $listOfMailboxes = Import-Csv mailboxes.txt
foreach( $mailbox in $listOfMailBoxes )
{
Set-Mailbox –Name $mailbox.Name -ForwardingAddress $mailbox.ForwardingAddress 
-DeliverToMailboxAndForward $false
}


From: listsad...@lists.myitforum.com [mailto:listsad...@lists.myitforum.com] On 
Behalf Of Michael B. Smith
Sent: Wednesday, May 10, 2017 4:59 PM
To: exchange@lists.myitforum.com
Subject: RE: [Exchange] Forwarding to a contact in O365.

foreach( <mailbox> in <listofmailboxes> )
{
               Set-Mailbox –Name <mailbox.name> -ForwardingAddress 
<mailbox.forwardingAddress> -DeliverToMailboxAndForward <$true/$false>
}


From: listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com> 
[mailto:listsad...@lists.myitforum.com] On Behalf Of John Matteson
Sent: Wednesday, May 10, 2017 4:36 PM
To: exchange@lists.myitforum.com<mailto:exchange@lists.myitforum.com>
Subject: [Exchange] Forwarding to a contact in O365.

Question for the group:

I have a bunch of mailboxes in O365 that need have forwarding set to a contact 
address. I'd like to do this via Powershell (there are 79 mailboxes that need 
to be set this way).

Is there a way of doing this?

Thanks.

John M.

Reply via email to