Michael Leonard
asked on
need assistance with a quest cmdlets script to add in a secondary alias
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.
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.
ASKER
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?
was hoping to avoid this and just add in the new additional smtp address. is that possible?
The script will collect emailAddresses of user then add the new one in to the list and then set it to user mailbox..
ASKER
Ok thx Subsun. I will test in the lab today to validate. can i also add in an x500 address using this logic?
Yes.. try with
$user.emailAddresses += "X500:$($_.newsmtp)"
$user.emailAddresses += "X500:$($_.newsmtp)"
ASKER
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.P roxyAddre
ssCollection". Error: "The address '/o=Accentus/ou=First Administrative Group/cn=Recipients/cn=201 0test-123' is invalid
: "/o=myorg/ou=First Administrative Group/cn=Recipients/cn=201 0test-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
}
the X500 test failed w/this error:
Exception setting "EmailAddresses": "Cannot convert value "System.Object[]" to type "Microsoft.Exchange.Data.P
ssCollection". Error: "The address '/o=Accentus/ou=First Administrative Group/cn=Recipients/cn=201
: "/o=myorg/ou=First Administrative Group/cn=Recipients/cn=201
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
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
fantastic subsun. many thanks!
S.
S.
Open in new window
Sample CSV file format..Open in new window