Solved

need assistance with a powershell script.

Posted on 2016-07-22
7
53 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 17

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
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

 

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 in simple steps how to renew expiring Exchange Server Internal Transport Certificate.
In this article, I am going to show you how to simulate a multi-site Lab environment on a single Hyper-V host. I use this method successfully in my own lab to simulate three fully routed global AD Sites on a Windows 10 Hyper-V host.
In this video we show how to create a mailbox database 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 Servers >> Data…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…

937 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