Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Importing bulk commands into Exchange 2010 Powershell

Posted on 2013-11-13
2
Medium Priority
?
286 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

This article will help to fix the below error for MS Exchange server 2010 I. Out Of office not working II. Certificate error "name on the security certificate is invalid or does not match the name of the site" III. Make Internal URLs and External…
A couple of months ago we ran into an issue that necessitated re-creating our Edge Subscriptions. However, when we attempted to execute the command: New-EdgeSubscription -filename C:\NewEdgeSub_01.xml we received an error indicating that the LDAP se…
In this video we show how to create an Accepted Domain 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 >> Ac…
In this video we show how to create an email address policy 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…

715 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