31 C
Dubai
Friday, November 22, 2024

Office 365 Mailbox not showing in Hybrid Exchange server

Newly created Mailbox not showing in Hybrid Exchange Server Control Panel.Not all administrators certainly know that they should not provision office 365 mailbox directly from the office 365 console. They should have used the Hybrid server to provision new cloud mailboxes.

User Created Directly on Active Directory and created a mailbox on Office 365 without using the hybrid server. Creating an issue on some mailboxes not visible in hybrid server

Below Commands will enable you to get the mailbox under Get-RemoteMailbox in Hybrid Exchange server.

Run on Azure AD Connect Server or Hybrid Exchange server with Active Directory Tools installed.

Please replace  domain / domain.com on 3 rd and 4th line with your appropriate domain names. You can get these info from a working mailbox.

$uid = read-host "Please enter username"
$mailnick = read-host "Please enter same username"
$tempmail = $uid+"@domain.mail.onmicrosoft.com"
$primarymail = $mailnick+"@domain.com"
Set-ADUser $uid -Clear homemdb, homemta, msExchHomeServerName, msExchPoliciesExcluded
Set-ADUser $uid -Add @{msExchRemoteRecipientType="4"}
Set-ADUser $uid -Add @{mailNickname="$mailnick"}
Set-ADUser $uid -Add @{msExchProvisioningFlags="0"}

Set-ADUser $uid -Add @{msExchModerationFlags="6"}
Set-ADUser $uid -Add @{msExchAddressBookFlags="1"}
Set-ADUser $uid -Replace @{targetaddress="$tempmail"}
Set-ADUser $uid -Replace @{msExchRecipientDisplayType="-2147483642"}
Set-ADUser $uid -Replace @{msExchRecipientTypeDetails="2147483648"}
Set-RemoteMailbox $uid -PrimarySMTPAddress $primarymail

This value you need to add from a working mailbox as the number differs with the exchange server version .
This one below is for exchange 2016 . Highly recommeneded to take it from a working mailbox.
If you skip this one it works but it will throw out a error later if you enable archive mailbox for the same user.

Set-ADUser $_.samaccountname -add @{msExchVersion="88218628259840"}

ArchiveGuid can’t be set on this object to enable archive mailbox


Bulk Script @azure365pro needs to be replaced in Line 6 and Line 7 Appropriately.

$upns = Import-csv m7.csv
foreach ($x in $upns)
{
$uid = $x.upn
$mailnick = $uid
$tempmail = $uid+"@azure365pro.mail.onmicrosoft.com"
$primarymail = $mailnick+"@localhost"
#Set-ADUser $uid -Clear homemdb,homemta,msExchHomeServerName,msExchPoliciesExcluded
#Set-ADUser $uid -Add @{msExchRemoteRecipientType="4"}
Set-ADUser $uid -Add @{mailNickname="$mailnick"}
Set-ADUser $uid -Add @{msExchProvisioningFlags="0"} 
Set-ADUser $uid -Add @{msExchModerationFlags="6"}
Set-ADUser $uid -Add @{msExchAddressBookFlags="1"}
Set-ADUser $uid -Replace @{targetaddress="$tempmail"}
Set-ADUser $uid -Replace @{msExchRecipientDisplayType="-2147483642"}
Set-ADUser $uid -Replace @{msExchRecipientTypeDetails="2147483648"}
Set-RemoteMailbox $uid -PrimarySMTPAddress $primarymail
}

 

Satheshwaran Manoharan
Satheshwaran Manoharanhttps://www.azure365pro.com
Award-winning Technology Leader with a wealth of experience running large teams and diversified industry exposure in cloud computing. From shipping lines to rolling stocks.In-depth expertise in driving cloud adoption strategies and modernizing systems to cloud native. Specialized in Microsoft Cloud, DevOps, and Microsoft 365 Stack and conducted numerous successful projects worldwide. Also, Acting as a Technical Advisor for various start-ups.

Related Articles

8 COMMENTS

  1. Can you give a description and a reason for each of the flags? Particularly, msExchModerationFlags=”6″ and msExchAddressBookFlags=”1″; possibly msExchProvisioningFlags=”0″. We’ve been going through our hybrid system, trying to make sure we’ve got things right. Usually, it works without any of the three that grabbed my curiosity above.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

× How can I help you?