Outlook 2016 and 2019 bypasses AutoDiscover and connects directly to Office 365 mailbox

Reference:

https://gist.github.com/ridercz/dc485d38da104835559c1ed8b78afad0


https://www.gothamweb.com/portal/index.php/knowledgebase/8/Outlook-bypasses-AutoDiscover-and-connects-directly-to-Office-365-mailbox.html

Starting in Outlook 2016 version 16.0.6741.2017, Microsoft has enabled a new feature called Direct Connect to Office 365. What this feature does is connect Outlook directly to Office 365 if Autodiscover is not working. This is great feature but a network hiccup may cause your mailbox to connect to Office 365 rather than your on premise Exchange, even with a valid autodiscover record.

For Direct Connect to take effect the user must have an active mailbox on Office 365 with a valid license. Typically Direct Connect would be a neat feature unles you are in the middle of a migration to 365, but a network hiccup could incorrectly connect you to 365 even though you haven't completed your migration yet.
During 365 migrations Hosted Exchange or On-Premise, we recommend disabling this option from the user computer registry:
You can stop Outlook from checking Office 365 for settings by setting a registry key.
HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\office\16.0\outlook\autodiscover
DWORD: ExcludeExplicitO365Endpoint
Value = 1
Then restart your computer and it should stop trying to connect to Office 365. When you are ready to flip the switch on your migration, remove this registry key.
Download: