?
Solved

powershell exchange 2010

Posted on 2014-01-30
3
Medium Priority
?
206 Views
Last Modified: 2014-01-30
Hey guys thanks for all your help in the past. I am just trying to figure out what am I doing here wrong as I am trying to add a bunch of primarysmtpaddresses for users and this is erroring out on the command line.


Import-Csv c:\temp\importfile.csv  | Foreach-Object {Set-Mailbox $_.username -primarysmtpaddress @{Add='$_primarysmtpaddress'}


username   primarysmtpaddress
username   username@contoso.local
username1  username1@contoso.local
username2  username2@contoso.local
username3  username3@contoso.local
0
Comment
Question by:techdrive
[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 40

Accepted Solution

by:
Subsun earned 2000 total points
ID: 39820783
Try by removing the single quotes, it won’t expand the variable.. Then, '.' (dot) is missing in '$_primarysmtpaddress'.

Since you are trying to change the primarysmtpaddress.. try the following..
Import-Csv c:\temp\importfile.csv  | Foreach-Object {Set-Mailbox $_.username -PrimarySmtpAddress $_.primarysmtpaddress -EmailAddressPolicyEnabled $false}

Open in new window

0
 

Author Comment

by:techdrive
ID: 39820892
oh I see and I noticed that you did not need to use the @{add} array thanks.
0
 
LVL 40

Expert Comment

by:Subsun
ID: 39820921
@{add="email@email.com"}  is used with parameter -EmailAddresses to add additional email addresses.
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

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 …
Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

777 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