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
Solved

need urgent assistance with powershell script to add variable.

Posted on 2016-07-25
3
64 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
  • 2
3 Comments
 
LVL 80

Accepted Solution

by:
David Johnson, CD, MVP earned 500 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

790 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