简体   繁体   中英

Exchange hybrid enviornment powershell add user with a mailbox

What is the best way to add a user in a hybrid on-prem/o365 deployment with a mailbox? If I go into Exchange Admin Center on either the on-prem or o365 and add a recipient it replicates it out to the other EAC as well as adding the user to active directory on prem. Looking thru the powershell documentation it looks like the New-Mailbox command should do that but I cant get it to work. Here is what I have so far.

Connect-ExchangeOnline -Credential $credential -ShowProgress $true 
Connect-AzureAD -Credential $credential
Connect-MsolService -Credential $credential
New-Mailbox -MicrosoftOnlineServicesID $uName"@mydomain.com" -Name "$fName $lName" -Password $secureString -ResetPasswordOnNextLogon $true

This creates the mailbox/user in o365 portal but not in on/off-prem EAC or active directory.

Steps:

  1. First Create user and Assign a License

    "New-ADUser -Name "user" -Accountpassword (Read-Host -AsSecureString "AccountPassword") -Enabled $true"

  2. Enable remote Mailbox

    "Enable-RemoteMailbox user -RemoteRoutingAddress user@domain.mail.onmicrosoft.com"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM