Hybrid Exchange duplicate Mailbox's issue

%3CLINGO-SUB%20id%3D%22lingo-sub-812125%22%20slang%3D%22en-US%22%3EHybrid%20Exchange%20duplicate%20Mailbox's%20issue%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-812125%22%20slang%3D%22en-US%22%3E%3CP%3EWe've%20discovered%20an%20issue%20where%20newly%20created%20users%20who%20are%20given%20365%20mailbox's%20also%20get%20an%20inhouse%20mailbox%20so%20some%20mail%20is%20delivered%20to%20one%20and%20some%20to%20the%20other%2C%20either%20way%20they%20miss%20email.%26nbsp%3B%20This%20script%20can%20detect%20these%20miss%20configured%20mailbox's.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20has%20to%20be%20run%20in%20an%20Exchange%20Online%20Powershell%20which%20can%20be%20loaded%20from%20the%20Exchange%20Admin%20center%20under%20Hybrid%20and%20press%20the%20second%20Configure%20button.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20%24MyUser%20variable%20contains%20your%20logon%20name.%26nbsp%3B%20In%20this%20script%20it's%20made%20up%20from%20the%20logon%20name%20and%20our%20domain%20but%20you'll%20need%20to%20modify%20it%20to%20suit%20you're%20environment.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E--------------Script----------------%3C%2FP%3E%3CP%3Ecls%3CBR%20%2F%3E%22Loading%20In%20House%20Mailbox%20Details%22%3CBR%20%2F%3EAdd-PSSnapin%20Microsoft.Exchange.Management.PowerShell.SnapIn%3CBR%20%2F%3E%24UserInHouses%20%3D%20Get-User%3CBR%20%2F%3E%22Loaded%22%3CBR%20%2F%3E%22Loading%20365%20Mailbox%20Details%22%3CBR%20%2F%3E%24MyUser%20%3D%20(get-childitem%20env%3AUSERNAME).Value%3CBR%20%2F%3E%24MyUser%20%2B%3D%20'%40OurDomain.com'%3CBR%20%2F%3E%24Session%20%3D%20connect-EXOPSSession%20-UserPrincipalName%20%24MyUser%3CBR%20%2F%3E%24Users365%20%3D%20get-user%3CBR%20%2F%3EGet-PSSession%20%7C%20Remove-PSSession%3CBR%20%2F%3E%22Loaded%22%3CBR%20%2F%3E%22Processing%22%3CBR%20%2F%3E%22%22%3CBR%20%2F%3E%22Duplicate%20User%20Mailbox's%3A-%22%3CBR%20%2F%3EForEach%20(%24UserInHouse%20in%20%24UserInHouses)%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3BForEach%20(%24User365%20in%20%24Users365)%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%7B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3Bif%20(%24User365.Name%20-like%20%24UserInHouse.Name)%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%7B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3Bif%20((%24User365.RecipientType%20-like%20'UserMailbox')%20-and%20(%24UserInHouse.RecipientType%20-like%20'UserMailbox'))%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%7B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%24User365.name%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%7D%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%7D%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%7D%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%22%22%3C%2FP%3E%3CP%3E--------------Script----------------%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20fix%20this%20problem%20r%3CSPAN%3Eemove%20the%20%3C%2FSPAN%3E%3CSTRONG%3EExchange%20Online%20(Plan%20**)%20%3C%2FSTRONG%3Elicence%20from%20their%20account%20and%20the%20online%20mailbox%20will%20be%20deleted.%26nbsp%3B%3CSTRONG%3E%20%26nbsp%3BIf%20there's%20data%20in%20there%20it%20will%20be%20lost%20so%20you'll%20have%20to%20back%20it%20up%20first.%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-812125%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3E365%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExchange%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EHybrid%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Visitor

We've discovered an issue where newly created users who are given 365 mailbox's also get an inhouse mailbox so some mail is delivered to one and some to the other, either way they miss email.  This script can detect these miss configured mailbox's.

 

It has to be run in an Exchange Online Powershell which can be loaded from the Exchange Admin center under Hybrid and press the second Configure button.

 

The $MyUser variable contains your logon name.  In this script it's made up from the logon name and our domain but you'll need to modify it to suit you're environment.

 

--------------Script----------------

cls
"Loading In House Mailbox Details"
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn
$UserInHouses = Get-User
"Loaded"
"Loading 365 Mailbox Details"
$MyUser = (get-childitem env:USERNAME).Value
$MyUser += '@OurDomain.com'
$Session = connect-EXOPSSession -UserPrincipalName $MyUser
$Users365 = get-user
Get-PSSession | Remove-PSSession
"Loaded"
"Processing"
""
"Duplicate User Mailbox's:-"
ForEach ($UserInHouse in $UserInHouses)
{
     ForEach ($User365 in $Users365)
     {
          if ($User365.Name -like $UserInHouse.Name)
          {
               if (($User365.RecipientType -like 'UserMailbox') -and ($UserInHouse.RecipientType -like 'UserMailbox'))
               {
                    $User365.name
               }
          }
     }
}
""

--------------Script----------------

 

To fix this problem remove the Exchange Online (Plan **) licence from their account and the online mailbox will be deleted.   If there's data in there it will be lost so you'll have to back it up first.

0 Replies