DirSync and Office 365

I wanted to share this for my own reference, but wanted to share the love.

Have been having a challenge with people thinking I am talking cr@p, which make me smile.  If I am wrong I will admit it.

When you setup DirSync, users from your onPrem AD are copied to the Office 365 Azure AD. Simple.

When you migrate (onboard) a mailbox to Office 365 the onPrem accounts change:

RecipientType RecipientTypeDetails RecipientType RecipientTypeDetails
UserMailbox UserMailbox -> MailUser RemoteUserMailbox
UserMailbox SharedMailbox -> MailUser RemoteSharedMailbox
UserMailbox RoomMailbox -> MailUser RemoteRoomMailbox

Now if you have a filter based on msExchRecipientTypeDetails you need to watch out, as expected the msExchRecipientTypeDetails changes:

Type Before After
User Mailbox 1 2147483648
Shared Mailbox 4 8589934592
Room Mailbox 16 17173869184
Equipment Mailbox 32 34359738368

This caused me some challenges as we had a filter that would only migrate disabled accounts with a value of 4 or 16 in msExchRecipientTypeDetails.

The net result was that after a Shared or Room mailbox was onboarded to o365 they would drop out of DirSync.  This is okay, as they stay in the Azure AD as a deleted user for 30 days.

You can recover a user from deleted users, they appear in Azure AD as “In Cloud” and any mailbox they had is accessible.

This is the fun bit. If the recovered user is added back in to dirsync, dirsync uses the Azure AD ImmutableId and compares that to an OnPrem Guid.  If a match they are become Dirsynced again.

You can see the ImmutableId when your run a get-msoluser.  Essentially it’s a fudge of the OnPrem AD ObjectGuid.  This post explains and here is a script to convert between the two.

Hope this helps someone, it helped me, get an understanding of what the hell was going on!

If this is complete cr@p let me know please!

OnPrem Lync/Skype and Office 365

Had an issue with mailboxes migrated to Office 365 while using OnPrem Lync/Skype.

Lync showed a constant “Enter Credentials” dialog:


The KB appears to have fixed it: Office 2013 and Lync 2013 periodically prompt for credentials to SharePoint Online, OneDrive, and Lync Online

A simple registry key that you can rollout with a GPO.

Exchange 2010 with UAG and Moving Mailboxes to o365

Came across this the other, when moving mailboxes from Exchange 2010 to Office 365.

The move works, but takes a hell of a long time.  If you look in the move logs you see:

Transient error MrsHttpInternalServerErrorException has occurred.

It would appear that UAG has a limit of some kind that is causing these errors.

I have not tried this, however Microsoft suggest you can try create following registry key on the UAG servers.

 Value: 30 (Decimal)

Microsoft suggests that this registry key should be removed from the servers, after completing the mailbox migration task.

Activate the UAG server configuration after applying this registry key and then do “IISreset” on all UAG servers.

Outlook says .. Microsoft Exchange is not available

This was is a good one and has been doing my head in!

I had a user mailbox that could log in to OWA but not Outlook.

With outlook you would get an error saying:

"Cannot open your default e-mail folders. Microsoft Exchange is not available. Ether there are network problems or the exchange Computer is down for maintenance"

If you run:

Get-LogonStatistics -Identity <email address>

Then have a look at the FullMailboxDirectoryName

This should match the users legacyexchangedn.  In my case, another user has the same address as a proxy address.

Just removed it and everything worked fine!


#Exchange2010 #MsExchange #Powershell

Hello every Happy New Year and all that .. long time to talk.

Wanted to share this.  Basically had a Cisco UCS Blade failure today, where it took 2 nodes of a 3 node Exchange 2010 dag out.

Its been a fun day! NOT!

Anyway, I knocked this script up to monitor the database copy status when we put everything back.

PARAM([String]$Server = (HOSTNAME),
[int]$time            = 30)

Write-Host "Server:.."$Server
Write-Host "Timer:..."$time
$position = $host.ui.rawui.cursorposition
$position.y = $position.y+4
  Get-MailboxDatabaseCopyStatus -Server $Server
  $endpos = $host.ui.rawui.cursorposition
  for($i=1;$i-le $time;$i++){write-host "." -nonewline -f Yellow;sleep 1}
  Write-Host (" "*$time)

Find Exchange Databases using Powershell

A small change in $strFilter=”(objectClass=msExchPrivateMDB)” and you get all the mailbox databases ;-)

$forest    = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest()
$Dom  = "LDAP://CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=" + $Forest.Name.Replace(".",",DC=")
$Root       = New-Object DirectoryServices.DirectoryEntry $Dom 
$selector   = New-Object DirectoryServices.DirectorySearcher 
$selector.PageSize    = 1000 
$selector.Filter      = $strFilter 
$selector.SearchRoot  = $root 
$selector.SearchScope = "Subtree" 
$Objs = $selector.findall() 

Find Exchange Servers using Powershell

#Powershell #MsExchange

I have a suite of discovery scripts that I use every now and then.  I adapted this to look in the AD and get a list of the exchange servers!

$forest    = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest()
$Dom = "LDAP://CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=" + $Forest.Name.Replace(".",",DC=")
$Root       = New-Object DirectoryServices.DirectoryEntry $Dom
$selector   = New-Object DirectoryServices.DirectorySearcher
$selector.PageSize   = 1000
$selector.Filter     = $strFilter
$selector.SearchRoot = $root
$selector.SearchScope = "Subtree"
$Objs = $selector.findall()

Get every new post delivered to your Inbox.