Solved

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

Posted on 2013-01-25
9
498 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
  • 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
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

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
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…

786 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