?
Solved

need urgent assistance with powershell script to add variable.

Posted on 2016-07-25
3
Medium Priority
?
77 Views
Last Modified: 2016-10-26
hello, can someone provide a way that we can feed this script with an input.csv

here is the logic:

New-AddressRewriteEntry -Name "<Descriptive Name>" -InternalAddress <internal email address> -ExternalAddress <external email address> [-OutboundOnly <$true | $false>]

Open in new window


i have a CSV with:
column 1 = internal email address
column 2 = external email address

need a way to define a variable so the script can reference the input CSV file and add these re-write entries for a list of users on the spreadsheet.

thanks in advance
0
Comment
Question by:siber1
[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
3 Comments
 
LVL 82

Accepted Solution

by:
David Johnson, CD, MVP earned 2000 total points
ID: 41728723
#input.csv header line
#descriptivename,InternalAddress,ExternalAddress,OutboundOnly
#Descriptive Rule,john.doe@machine.local,jdoe@example.com,
#Descriptive Rule2,john.smith@machine.local,jsmith@example.com,True
$infile = 'c:\test\input.csv'
$users = import-csv -path $infile
foreach($user in $users){
$outboundonly = $false
if ($user.OutboundOnly -eq 'true') { $outboundonly = $true }
New-AddressRewriteEntry -Name $user.Descriptive Name -InternalAddress $user.internalemailaddress -ExternalAddress $user.externalemailaddress -OutboundOnly $outboundonly
}

Open in new window

0
 

Author Comment

by:siber1
ID: 41728734
excellent. just what we were looking for. thanks
0
 

Author Closing Comment

by:siber1
ID: 41744709
trying to close out ticket again.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses
Course of the Month13 days, 15 hours left to enroll

801 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