Hi,
I have a problem when setting the PrimarySmtpAddress through PowerShell/C#. Our standard email addresses in the forest is somebody@company.com but our is somebody@company.dk.
I'm able to set the smtp address but it's failing when setting the EmailAddressPolicyEnabled to true. Logical I can see why ;-), but I'm still able to enable it through the EMC. Is there any way to do it through code?
My code:
<snip>
psScript.AppendLine("[bool](Get-User -Identity "somebody" -DomainController dc.somewhere.com | Enable-Mailbox -Alias "somebody" -Database "ExchDB" -PrimarySmtpAddress"somebody@company.dk");
psScript.AppendLine("Set-Mailbox -Identity "somebody"-EmailAddressPolicyEnabled $true");
</snip>
Thanks, Morten