bpl5000
asked on
How to add SMTP address to proxyAddresses
How can I add an SMTP address to proxyAddresses? I tried...
Set-ADUser -identity john.doe -add proxyAddresses = "SMPT:john.doe@domain.org"
This does not work. I can do it manually in ADUCT under Attribute Editor in the properties of the user, but I need to do this for a large group of users. Please no links, I'm looking for the command to use.
Set-ADUser -identity john.doe -add proxyAddresses = "SMPT:john.doe@domain.org"
This does not work. I can do it manually in ADUCT under Attribute Editor in the properties of the user, but I need to do this for a large group of users. Please no links, I'm looking for the command to use.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
These accounts do not yet have mailboxes, but piattnd's way will work. I tested piattnd's commands and it added the proxy address perfectly, but I need to do this for 4 thousand users. How can I do this if I have a text file with the usernames? The addresses that I'm trying to add are "SMTP:username@mydomain.or g". Is there anyway I can use a file to add this attribute to several users?
ASKER
I tired to separate the commands with pipes, like...
$user = Get-ADUser john.doe -Properties mail,department,ProxyAddre sses | $user.ProxyAddresses = "SMTP:john.doe@mydomain.or g" | Set-ADUser -instance $user
But it doesn't seem to like pipes. If there was a way to separate commands, I could generate a file that would work for multiple accounts.
$user = Get-ADUser john.doe -Properties mail,department,ProxyAddre
But it doesn't seem to like pipes. If there was a way to separate commands, I could generate a file that would work for multiple accounts.
If it is not a user with mailbox then you can try..
Set-ADUser subsun -Add @{ProxyAddresses="SMTP:subsun@domain.com"}
For bulk modification..Import-Module Activedirectory
Import-csv C:\input.csv | % {
Set-ADUser $_.sAMAccountName -Add @{ProxyAddresses="SMTP:$($_.Email)"}
}
Input csv file format..sAMAccountName,Email
User1,User1@domain.com
User2,User2@domain.com
User3,User3@domain.com
ASKER
That's perfect, but since the email addresses all end with @mydomain.org, can I do something like this...
Set-ADUser $_.sAMAccountName -Add @{ProxyAddresses="SMTP:$($ _.sAMAccou ntName)@my domain.org "}
Also, is the $ that comes after SMTP: needed? Is this an escape character because it's within quotes?
Set-ADUser $_.sAMAccountName -Add @{ProxyAddresses="SMTP:$($
Also, is the $ that comes after SMTP: needed? Is this an escape character because it's within quotes?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you're running exchange, why not use the recipient policy to handle this.
http://support.microsoft.c om/kb/8224 47
Using the recipient policy to manage default email addresses ensures that users that match the search criteria all have AT A MINIMUM the configuration you specified. Lets say you have 3 email addresses you want everyone to have, but one to be default. Make a recipient policy that designates your search scope (unlimited options) and enter the address settings as required. Anyone who meets the requirements from that point forward will automatically have their settings changed and it does support the use of reference to their login name to be in the email address.
Using the recipient policy to manage default email addresses ensures that users that match the search criteria all have AT A MINIMUM the configuration you specified. Lets say you have 3 email addresses you want everyone to have, but one to be default. Make a recipient policy that designates your search scope (unlimited options) and enter the address settings as required. Anyone who meets the requirements from that point forward will automatically have their settings changed and it does support the use of reference to their login name to be in the email address.
One last note, recipient policy will NOT remove email addresses that you do not put in the policy. It is meant to add or modify only, not remove email addresses.
If your policy defines email address a, b, and c, but a user has email address d currently, the user will get email addresses a, b, c, and d (the default will be the one you specify).
If your policy defines email address a, b, and c, but a user has email address d currently, the user will get email addresses a, b, c, and d (the default will be the one you specify).
ASKER
These users are not Exchange users.
Well then that explains that! Bummer, would have been a more robust fix. It looks like Subsun may have the ultimate solution for you then, though I haven't tried his code.
ASKER
Subsun's way does work. Piattnd's way also works and I was developing a file using semicolons to separate the commands until Subsun posted his solution. Thanks for all the help!
Check out this site: https://www.365powershell.com/
They are working on a GUI to make modifying smtp email aliases / proxyAddressess quick and easy for those of us that prefer a graphical interface over command line.
I was able to get a beta release by contacting them, but they say a release candidate almost ready! I'm also excited for the user syncback feature, been looking everywhere for that functionality.
They are working on a GUI to make modifying smtp email aliases / proxyAddressess quick and easy for those of us that prefer a graphical interface over command line.
I was able to get a beta release by contacting them, but they say a release candidate almost ready! I'm also excited for the user syncback feature, been looking everywhere for that functionality.
Open in new window