Solved

need assistance with a powershell script.

Posted on 2016-07-22
7
71 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 23

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 70

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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

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

Are You Headed to Black Hat USA 2017?

Getting ready for Black Hat next week? Kick things off with the WatchGuard Badge Challenge and test your puzzle and cipher skills. Do you have what it takes to earn our limited edition Firebox Badge? Get started today - https://crimsonthorn.net

Question has a verified solution.

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

After hours on line I found a solution which pointed to the inherited Active Directory permissions . You have to give/allow permissions to the "Exchange trusted subsystem" for the user in the Active Directory...
Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
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
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
Suggested Courses

632 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