Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Importing bulk commands into Exchange 2010 Powershell

Posted on 2013-11-13
2
Medium Priority
?
291 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 2000 total points
ID: 39647305
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
ID: 39656091
This seems to have done the trick, many thanks.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

With so many activities to perform, Exchange administrators are always busy in organizations. If everything, including Exchange Servers, Outlook clients, and Office 365 accounts work without any issues, they can sit and relax. But unfortunately, it…
How to effectively resolve the number one email related issue received by helpdesks.
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Suggested Courses

926 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