Solved

Importing bulk commands into Exchange 2010 Powershell

Posted on 2013-11-13
2
273 Views
Last Modified: 2013-11-18
We currently have a list of email accounts (john.doe@aaa.com) along with corresponding Mail Contacts for a forwarding address (john.doe@bbb.com)

Using the command

set-mailbox -identity John.Doe -ForwardingAddress "John.Doe@bbb.com" -DeliverToMailAndForward $false

When looking at the mailflow settings, it all appears fine and works.

We have 200+ of these to do and would like to know the best way to do this

I have tried to use the above command and have 200+ individual lines of the code on a csv file and then tried to import using Import-CSV c:\mail.csv

When this runs, it just displays the contents of the CSV file and doesn't seem to run the command.
0
Comment
Question by:ISD-PLC
2 Comments
 
LVL 18

Accepted Solution

by:
irweazelwallis earned 500 total points
Comment Utility
you would need some kind of foreach loop in there to process through

for example

$importedusers = Import-csv "C:\users.csv"

foreach ($importeduser in $importedusers)
               {set-mailbox -identity $importeduser.usersname -ForwardingAddress $importeduser.forwardadd -DeliverToMailAndForward $false}

In you CSV file you would need column names of username and forwardadd
0
 
LVL 1

Author Comment

by:ISD-PLC
Comment Utility
This seems to have done the trick, many thanks.
0

Featured Post

Do email signature updates give you a headache?

Do you spend too much time managing email signatures? Hate visiting every user’s desk to make updates? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Well, let Exclaimer give your company the email signature it deserves!

Join & Write a Comment

Easy CSR creation in Exchange 2007,2010 and 2013
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this video we show how to create a Shared Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Sha…
To show how to create a transport rule in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Rules tab.:  To cr…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now