Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

need urgent assistance with powershell script to add variable.

Posted on 2016-07-25
3
Medium Priority
?
79 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 83

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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Want to know how to use Exchange Server Eseutil command? Go through this article as it gives you the know-how.
As much as Microsoft wants to kill off PST file support, just as they tried to do with public folders, there are still times when it is useful or downright necessary to export Exchange mailboxes to PST files. Thankfully, it is still possible to e…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

618 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