SET specific primarysmtpaddress
Hello,
I use Exchange 2007 and received csv file from the AD tema when user is created.
CSV file:
Identity,primarysmtpaddress,ExternalEmailAddress
"company.intra/User Test/up date",up.date@company.com,ud2010@COMP.INTRA
PS1: (I have tried)
import-csv "C:\Scripts\Account.csv" | foreach {enable-MailUser -identity $_.identity -primarysmtpaddress $_.primarysmtpaddress -ExternalEmailAddress $_.ExternalEmailAddress} | Set-Mailuser -emailaddresspolicyenabled:$True
It does create the user but I can not manage to have
up.date@company.com set as primarysmtpaddress (as per the above example).
The result is that I have both primarysmtpaddress and ExternalEmailAddress set as
2010@COMP.INTRA
Thanks in advance if you can enlighten me.
Graig
November 30th, 2010 4:31am
I did run the same ps1 without the "| Set-Mailuser -emailaddresspolicyenabled:$True" and I obtain what I was looking for.
Is there any way to force the primarysmtpaddress with keeping the emailaddresspolicyenabled as True??
(workaround: I set the emailaddresspolicyenabled as fasle click on Apply, reset the primarysmtpaddress I needed and reset the policy as true and apply).
Free Windows Admin Tool Kit Click here and download it now
November 30th, 2010 4:46am
Sorry for adding information as one goes along but I have check my eamil address policy and as my account as a specific custom attribut set up the email address policy should set the user properly (%r -%g.%r
_%s@company.com) So I really do not know/understand what is going on..
Any help/advice would be appreciated.
November 30th, 2010 5:10am
On Tue, 30 Nov 2010 09:25:06 +0000, Graiggoriz wrote:
>
>
>Hello,
>
>I use Exchange 2007 and received csv file from the AD tema when user is created.
>
>CSV file: Identity,primarysmtpaddress,ExternalEmailAddress "company.intra/User Test/up date",up.date@company.com,ud2010@COMP.INTRA
>
>PS1: (I have tried) import-csv "C:\Scripts\Account.csv" | foreach {enable-MailUser -identity $_.identity -primarysmtpaddress $_.primarysmtpaddress -ExternalEmailAddress $_.ExternalEmailAddress} | Set-Mailuser -emailaddresspolicyenabled:$True
>
>It does create the user but I can not manage to have up.date@company.com set as primarysmtpaddress (as per the above example).
>
>The result is that I have both primarysmtpaddress and ExternalEmailAddress set as 2010@COMP.INTRA
>
>Thanks in advance if you can enlighten me. Graig
The primary and external SMTP addresses should be the same. The
mail-enabled user shoud have a secondary SMTP address in one of your
accepted domains if you want it to be addressable using a "company
address". You should also turn OFF the "emailaddresspolicyenabled" so
your address policies don't override whatever decisions you're making
on your own.
---
Rich Matheisen
MCSE+I, Exchange MVP
--- Rich Matheisen MCSE+I, Exchange MVP
Free Windows Admin Tool Kit Click here and download it now
November 30th, 2010 10:28pm
On Tue, 30 Nov 2010 09:40:17 +0000, Graiggoriz wrote:
>
>
>I did run the same ps1 without the "| Set-Mailuser -emailaddresspolicyenabled:$True" and I obtain what I was looking for.
>
>Is there any way to force the primarysmtpaddress with keeping the emailaddresspolicyenabled as True??
No. That's the whole point of having a *policy*.
>(workaround: I set the emailaddresspolicyenabled as fasle click on Apply, reset the primarysmtpaddress I needed and reset the policy as true and apply).
When you do that the policy will be applied -- that's not what you
want, is it?
---
Rich Matheisen
MCSE+I, Exchange MVP
--- Rich Matheisen MCSE+I, Exchange MVP
November 30th, 2010 10:30pm
First, I am not a power shell expert. If you want to get further support about power shell, suggest you ask a question in windows power shell forum.
http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/threads
As I know, the "PrimarySmtpAddress" parameter disables the flag "EmailAddressPolicyEnabled" and doesn't apply any email address policy on this new mailbox which also
may cause the CSV file does not work. Hence it’s recommended to create the mailbox without enabling Email Address Policy. After completing, you can use Set-Mailbox with the EmailAddressPolicyEnabled.
For more information, please refer to the following article:
http://social.technet.microsoft.com/Forums/en/exchangesvradmin/thread/99a696ad-59cc-47ec-a9b0-9790ab2908e7
Thanks.
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
December 2nd, 2010 3:02am
Thanks to both. I will check that up.
Just for further information:
In fact the mail user receive their email via a specific external email address. A send connector route mails to another messaging system.
I need to enable the mailuser who is already created on the AD side. In fact I receive a CSV file with the canonical name, primary Email address, external email address.
EG:
Identity,primarysmtpaddress,ExternalEmailAddress
"company.intra/User/Test/up date","up.date@com-pany.com","ud2010@company.INTRA"
My question is to know if there is anyway to create/enable a mail user based on those criterias:
Get-MailUser -Identity UD2010 | ft ExternalEmailAddress,SamAccountName,EmailAddressPolicyEnabled,PrimarySmtpAddress
ExternalEmailAddress : SMTP:ud2010@company.INTRA
SamAccountName : UD2010
EmailAddressPolicyEnabled : True
PrimarySmtpAddress :
up.date@com-pany.com
December 2nd, 2010 4:09am
On Thu, 2 Dec 2010 09:08:57 +0000, Graiggoriz wrote:
>
>
>Thanks to both. I will check that up.
>
>Just for further information:
>
>In fact the mail user receive their email via a specific external email address. A send connector route mails to another messaging system. I need to enable the mailuser who is already created on the AD side. In fact I receive a CSV file with the canonical
name, primary Email address, external email address.
>
>EG: Identity,primarysmtpaddress,ExternalEmailAddress "company.intra/User/Test/up date","up.date@com-pany.com","ud2010@company.INTRA"
>
>My question is to know if there is anyway to create/enable a mail user based on those criterias:
>
>Get-MailUser -Identity UD2010 | ft ExternalEmailAddress,SamAccountName,EmailAddressPolicyEnabled,PrimarySmtpAddress
>
>ExternalEmailAddress : SMTP:ud2010@company.INTRA SamAccountName : UD2010 EmailAddressPolicyEnabled : True PrimarySmtpAddress : up.date@com-pany.com
Well, just to get terminology straight, the "primarysmtpaddress" value
is mislabled. The value it contains is really a secondary SMTP
address.
Assuming that the address policy application is already disabled for
the user, this is what the command would look like:
set-mailuser -id "company.intra/User/Test/up date" -emailaddresses
smtp:up.date@com-pany.com,SMTP:ud2010@company.INTRA
-ExternalEmailAddress ud2010@company.INTRA
I haven't tried this, but the parameterized version of that would look
like either this:
set-mailuser -id $_.identity -emailaddresses
smtp:$_.primarysmtpaddress,SMTP:$_.ExternalEmaiAddress
or this:
set-mailuser -id $_.identity -emailaddresses
smtp:$($_.primarysmtpaddress),SMTP:$($_.ExternalEmaiAddress)
---
Rich Matheisen
MCSE+I, Exchange MVP
--- Rich Matheisen MCSE+I, Exchange MVP
Free Windows Admin Tool Kit Click here and download it now
December 2nd, 2010 11:04pm
Hello Rich,
Thanks for your input! I have tried with bot and did not manage to make it work. However, I had to change the set-mail user by get-content + enable user:
I tried:
import-csv "C:\auto.csv" | foreach {enable-MailUser -identity $_.identity -emailaddresses smtp:$_.primarysmtpaddress,SMTP:$_.ExternalEmaiAddress
December 10th, 2010 8:22am
On Fri, 10 Dec 2010 13:21:56 +0000, Graiggoriz wrote:
>Thanks for your input! I have tried with bot and did not manage to make it work. However, I had to change the set-mail user by get-content + enable user:
>
>I tried:
>
>import-csv "C:\auto.csv" | foreach {enable-MailUser -identity $_.identity -emailaddresses smtp:$_.primarysmtpaddress,SMTP:$_.ExternalEmaiAddress
Well, as I said, "Assuming that the address policy application is
already disabled for the user . . .". Since you're using
Enable-MailUser it's safe to say that the policy application is *not*
disabled! Further, there's no way to disable the policy using the
enable-mailuser cmdlet.
So . . .
....{enable-mailuser -id $_.identity -externalemailaddress
$_.externalemailaddress | set-mailuser etc...}
---
Rich Matheisen
MCSE+I, Exchange MVP
--- Rich Matheisen MCSE+I, Exchange MVP
Free Windows Admin Tool Kit Click here and download it now
December 10th, 2010 10:26pm