Solved

need assistance with a powershell script.

Posted on 2016-07-22
7
62 Views
Last Modified: 2016-10-22
hello, we have this script that works perfect on exchange 2010 to add additional SMTP alias, however this does not work on exchange 2007.

can someone modify this so it will work on 2007?

thanks in advance:

Import-Csv alias-add-var-gen1.csv | % {
$user = Get-Mailbox $_.SMTP 
$user.emailAddresses += $_.newsmtp
Set-Mailbox $user -emailAddresses $user.emailAddresses
}

Open in new window

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
7 Comments
 
LVL 22

Expert Comment

by:Patrick Bogers
ID: 41725894
Hi

Except that + sign in line 3 it looks ok, have no exchange2007 anymore to check but can imagine you differ in PS versions, maybe update powershell on the 2007 box.
(PS C:\> $PSVersionTable.PSVersion)

Cheers!
0
 
LVL 17

Expert Comment

by:Learnctx
ID: 41726227
What error do you get back?
0
 
LVL 69

Accepted Solution

by:
Qlemo earned 500 total points
ID: 41726497
I cannot detect an issue either, so we need the error message, as requested by Learnctx.
However, I would compress the script slightly:
Import-Csv alias-add-var-gen1.csv | % {
  Get-Mailbox $_.SMTP | Set-Mailbox -emailAddresses @($user.emailAddresses)+$_.newsmtp
}

Open in new window

0
Independent Software Vendors: 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!

 

Author Comment

by:siber1
ID: 41728678
thanks Qlemo - I retested and this works fine.
0
 

Author Comment

by:siber1
ID: 41728681
hi Qlemo - i keep trying to award you points but this system again will not let me close out the ticket, I've contacted someone by the name of mr. wolfe to try and fix the bug in this system, this keeps happening..
0
 

Author Closing Comment

by:siber1
ID: 41744711
trying to close out ticket again and assign points
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

This article explains the steps required to use the default Photos screensaver to display branding/corporate images
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

740 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