Just in case it wasn’t clear, start with mailboxes.txt. It includes (as a sample) the following lines:
Name,ForwardingAddress george,[email protected] andy,[email protected] michael,[email protected] 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: [email protected] [mailto:[email protected]] On Behalf Of Michael B. Smith Sent: Wednesday, May 10, 2017 4:59 PM To: [email protected] 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: [email protected]<mailto:[email protected]> [mailto:[email protected]] On Behalf Of John Matteson Sent: Wednesday, May 10, 2017 4:36 PM To: [email protected]<mailto:[email protected]> 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.
