Solved

need assistance with a quest cmdlets script to add in a secondary alias

Posted on 2013-01-25
9
505 Views
Last Modified: 2013-01-25
is there a way to add in a secondary email address to a group of 100 accounts in a particular OU based on an input file using the quest ad cmdlets?

so for example:
the primary email address for these 3 are:
bob.smith@xyz.com
john.smith@xyz.com
joe.brown@xyz.com

and i want to add in a secondary alias to each like:
bsmith@sym.com
jsmith@sym.com
jbrown@sym.com

thx in advance!

S.
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
  • 4
  • 4
9 Comments
 
LVL 40

Expert Comment

by:Subsun
ID: 38819100
Try this..
Import-Csv Test.csv | % {
$user = Get-Mailbox $_.SMTP 
$user.emailAddresses += $_.newsmtp
Set-Mailbox $user -emailAddresses $user.emailAddresses
}

Open in new window

Sample CSV file format..
SMTP,newsmtp
bob.smith@xyz.com,bsmith@sym.com
john.smith@xyz.com,jsmith@sym.com
joe.brown@xyz.com,jbrown@sym.com

Open in new window

0
 
LVL 11

Expert Comment

by:netballi
ID: 38819167
0
 

Author Comment

by:siber1
ID: 38819182
hi Subsun, using your logic would we have to capture the full proxyAddresses string first for each user?
was hoping to avoid this and just add in the new additional smtp address. is that possible?
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 40

Expert Comment

by:Subsun
ID: 38819202
The script will collect emailAddresses of user then add the new one in to the list and then set it to user mailbox..
0
 

Author Comment

by:siber1
ID: 38819245
Ok thx Subsun. I will test in the lab today to validate. can i also add in an x500 address using this logic?
0
 
LVL 40

Expert Comment

by:Subsun
ID: 38819297
Yes.. try with
$user.emailAddresses += "X500:$($_.newsmtp)"
0
 

Author Comment

by:siber1
ID: 38819534
thx Subsun. the additional smtp +add script works perfect! thx much!

the X500 test failed w/this error:

Exception setting "EmailAddresses": "Cannot convert value "System.Object[]" to type "Microsoft.Exchange.Data.ProxyAddre
ssCollection". Error: "The address '/o=Accentus/ou=First Administrative Group/cn=Recipients/cn=2010test-123' is invalid
: "/o=myorg/ou=First Administrative Group/cn=Recipients/cn=2010test-123" isn't a valid SMTP address. The domain name
 can't contain spaces and it has to have a prefix and a suffix, such as example.com.""

here is how i have the script:

Import-Csv Test.csv | % {
$user = Get-Mailbox $_.SMTP
$user.emailAddresses += "X500:$($_.newsmtp)"
Set-Mailbox $user -emailAddresses $user.emailAddresses
}
0
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 38819899
I think it's problem with input csv file format.. Should look like..
SMTP,newsmtp
bob.smith@xyz.com,/o=Accentus/ou=First Administrative Group/cn=Recipients/cn=2010test-123
john.smith@xyz.com,/o=Accentus/ou=First Administrative Group/cn=Recipients/cn=2010test-456
joe.brown@xyz.com,/o=Accentus/ou=First Administrative Group/cn=Recipients/cn=2010test-678

Open in new window

0
 

Author Closing Comment

by:siber1
ID: 38819950
fantastic subsun. many thanks!

S.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

This article will help to fix the below error for MS Exchange server 2010 I. Out Of office not working II. Certificate error "name on the security certificate is invalid or does not match the name of the site" III. Make Internal URLs and External…
In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
how to add IIS SMTP to handle application/Scanner relays into office 365.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

695 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