Powershell 交换模块远程邮箱问题

Powershell Exchange Module remote mailbox issue

我创建了一个脚本,可以在 Exchange 中自动创建一个用户,然后从 o365 向它添加一个许可证,但是我需要底部的框,上面写着 "automatically update email addresses based on the email address policy applied to this recipient",以便在帐户时自动勾选被建造。

这里是创建远程邮箱的主要组件:

New-RemoteMailBox -Alias $identAlias -Name $name -FirstName $return[0] -LastName $return[1] -UserPrincipalName $eAddress  -Password (ConvertTo-SecureString -String 'xxxxxxx' -AsPlainText -Force) -ResetPasswordOnNextLogon $true 

请帮忙!

申请all users

Get-mailbox | Set-mailbox -EmailAddressPolicyEnabled $true

并按域限制

Get-mailbox | Where {$_.EmailAddresses -like ‘*@domain.com’} |
 Set-mailbox -EmailAddressPolicyEnabled $true

和远程

Get-mailbox | Where {$_.EmailAddresses -like ‘*@domain.com’} |
Set-RemoteMailbox EmailAddressPolicyEnabled