Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

PowerShell -EmailAddressPolicyEnabled $true while setting PrimarySmtpAddress

$
0
0

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


Viewing all articles
Browse latest Browse all 7132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>