Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

need assistance with a powershell script.

Posted on 2016-07-22
7
Medium Priority
?
79 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
6 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 18

Expert Comment

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

Accepted Solution

by:
Qlemo earned 2000 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
 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

 

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

New Tabletop Appliances Blow Competitors Away!

WatchGuard’s new T15, T35 and T55 tabletop UTMs provide the highest-performing security inspection in their class, allowing users at small offices, home offices and distributed enterprises to experience blazing-fast Internet speeds without sacrificing enterprise-grade security.

Question has a verified solution.

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

How to effectively resolve the number one email related issue received by helpdesks.
Steps to fix “Unable to mount database. (hr=0x80004005, ec=1108)”.
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…
Loops Section Overview

824 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