Outlook cannot set up the account, or connects to the wrong server
Account setup fails, or Outlook keeps finding a mailbox on a server that is no longer used. Autodiscover checks several sources in a fixed order and stops at the first one that answers, so a stale answer early in that order wins over a correct one later.
What you see
"Outlook cannot complete the setup" or "We're having trouble connecting" on a mailbox that works in a browser. Or the account sets up but points at an old on-premises server after a migration, sometimes with a certificate warning naming a domain nobody recognises.
What is actually wrong
Autodiscover tries, in order: a policy-supplied XML, the Active Directory service connection point, https at the root of the mail domain, https at autodiscover.<domain>, an SRV record, and finally the Microsoft 365 endpoint. A leftover SCP in AD, or a web server at the domain root answering on 443, is enough to stop the sequence with the wrong answer.
Codes and articles
Start here — find out which fix applies
A script that runs the 2 inspection commands from the write-up below and prints what each one returned. It reads the machine and changes nothing — every command that could write, delete, start or stop is excluded from it by construction. Run this first, then pick the fix its output points at.
Fixes (4)
Find out which step is answering
Always start here. Autodiscover has a built-in test that shows the whole sequence and where it stopped, and guessing without it wastes hours.
Hold Ctrl and right-click the Outlook icon in the notification area, then choose Test E-mail AutoConfiguration.
This is the single most useful diagnostic for this fault and almost nobody knows it exists. It is hidden behind Ctrl because it is a support tool rather than a user feature.
Enter the address, clear the Use Guessmart and Secure Guessmart Authentication boxes, leave Use AutoDiscover ticked, and press Test.
Read the Log tab, not the Results tab. It lists every URL tried in order with the outcome of each, and the first success is the answer Outlook is using.
The Results tab tells you what it found. The Log tab tells you where it found it, which is what you actually need in order to fix it.
Note the URL of the first successful step. That is the thing to correct — everything after it is irrelevant.
Deal with a stale service connection point
The log shows an internal Exchange URL being found, on a network where the mailbox has moved to Microsoft 365.
List the service connection points published in Active Directory.
([adsisearcher]'(&(objectClass=serviceConnectionPoint)(serviceClassName=ms-Exchange-AutoDiscover-Service))').FindAll() | ForEach-Object { $_.Properties.servicebindinginformation }A domain-joined machine checks AD before it checks DNS, and it trusts what it finds. A decommissioned Exchange server that was never cleanly removed leaves its SCP behind, and every domain-joined client keeps being sent to it.
If the old Exchange server is genuinely gone, the SCP should be removed as part of decommissioning it. That is an Exchange administration task and should be done properly rather than by deleting objects by hand.
As an interim measure on affected clients, tell Outlook to skip the SCP lookup.
$k='HKCU:\Software\Microsoft\Office\16.0\Outlook\AutoDiscover'New-Item $k -Force | Out-NullSet-ItemProperty $k -Name ExcludeScpLookup -Type DWord -Value 1
Restart Outlook and run the AutoConfiguration test again to confirm it now moves past that step.
Treat the registry value as temporary. It is a client-side workaround for a server-side problem, and it has to be deployed to every machine and every new build until the SCP is actually removed.
This is the step that turns a two-week fix into a permanent piece of estate debt if it is skipped. Record it somewhere and remove it once the SCP is gone.
Check the DNS records the lookup depends on
Setup fails from any network, or the log shows a lookup failing at the DNS steps.
Check the autodiscover record for the mail domain.
Resolve-DnsName autodiscover.yourdomain.com | Select-Object Name, Type, NameHost, IP4AddressFor Microsoft 365 this should be a CNAME to autodiscover.outlook.com. An A record pointing at an old server, or no record at all, is the usual finding.
Check whether anything is answering at the root of the domain on 443, since that step comes first.
Test-NetConnection yourdomain.com -Port 443 | Select-Object RemoteAddress, TcpTestSucceededA marketing website at the domain root will answer the https root-domain probe and return HTML rather than autodiscover XML. Outlook has to time out on it before moving on, which is why setup can take minutes and then fail.
Check for an SRV record, which is the supported alternative when the root domain is in use.
Resolve-DnsName -Type SRV _autodiscover._tcp.yourdomain.com -ErrorAction SilentlyContinueRun Microsoft's remote analyser against the address, which tests the whole sequence from outside your network and reports each step.
Start-Process 'https://testconnectivity.microsoft.com/'Correct the records at the DNS provider. Allow for the TTL before retesting, and remember that a negative answer can be cached too.
Clear client-side overrides someone left behind
One machine behaves differently from the rest, or a certificate warning names an unexpected domain.
Read the whole AutoDiscover key. Anything in it is an override somebody applied deliberately at some point.
Get-ItemProperty 'HKCU:\Software\Microsoft\Office\16.0\Outlook\AutoDiscover' -ErrorAction SilentlyContinueExcludeHttpsRootDomain, ExcludeHttpsAutoDiscoverDomain, ExcludeSrvRecord, PreferLocalXML and ExcludeExplicitO365Endpoint each remove a step from the sequence. A value copied from a forum years ago to fix something else is a common cause of a machine that will not set up now.
Check the policy hive as well, which overrides the user one.
Get-ItemProperty 'HKCU:\Software\Policies\Microsoft\Office\16.0\Outlook\AutoDiscover' -ErrorAction SilentlyContinueBack up the key before clearing it, so you can put back anything that turns out to have been load-bearing.
reg export "HKCU\Software\Microsoft\Office\16.0\Outlook\AutoDiscover" "$env:USERPROFILE\Desktop\autodiscover-backup.reg" /yRemove the overrides that are not deliberate, then restart Outlook and retest.
Remove-Item 'HKCU:\Software\Microsoft\Office\16.0\Outlook\AutoDiscover' -Recurse -Force -ErrorAction SilentlyContinue
Related faults
Where this stops. This write-up was written and checked by hand. It says what each step changes, how to confirm it worked and how to reverse it, and anything destructive is flagged before you reach it. If it does not match what your machine is doing, search the Support Centre for the exact code or message — and when something needs a person, get in touch.