Solved

need assistance with a powershell script.

Posted on 2016-07-22
7
48 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
7 Comments
 
LVL 19

Expert Comment

by:Patricksr1972
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 16

Expert Comment

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

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
 

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

Join & Write a Comment

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
In this video we show how to create a Contact in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Contact ta…
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

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now