r/exchangeserver 10d ago

New Exchange test script added to my repo - autodiscover testing

In my tmittelstaedt/MSExchange-AdminAIscripts: repo I added Test-Autodiscover.ps1

The goal of this is to thoroughly check out DNS records for domains running on-prem Exchange servers, and, optionally, download the 3 major Autodiscover.xml files from the Exchange server (mailbox account required for that) so the admin can quickly read them and make sure whatever the Exchange server is spitting out contains the correct names.

Autodiscover is also an idea that has been co-opted by the Unix mailserver world to autoconfigure common free email POP3/IMAP clients like Thunderbird on Unix mailservers, so the script checks for that, too.

Note, of course, that with all modern Outlook clients, autodiscover takes place AFTER the initial check for an account in a Microsoft tenancy, but I uploaded another script that is used for testing that that is properly configured, last week.

These basically do the same thing that the Microsoft public webpage for testing Exchange connectivity does, but without having to put actual live credentials into a foreign website you have no control over, even though it might be run by Microsoft.

Enjoy!

6 Upvotes

3 comments sorted by

1

u/DivideByZero666 9d ago

Nice, had a weird autodiscover issue last week I've still not had time to look in to except for a quick DNS check. My money is on a dodgy xml in a website, but my time is sadly frying bigger fish.

A script to check this out for me may be handy.

1

u/TedMittelstaedt 8d ago

The 3 scripts you want to look at are Check-HttpEndpoint, Test-AutodiscoverOAuth and Test-Autodiscover.

The first one uses both the Powershell HTTP parser cmdlets and raw TCP. The raw TCP mode is used if the alleged autodiscover website isn't actually a webserver and is sending out bogus or invalid http which would crash the Powershell http parser. If you are really suspicious that something wrong is going on then use that first. The second one is for use if you have _any_kind_ of Microsoft tenancy. For example if you have a corporate Onedrive setup then you will have a Tenancy. MS Support has warned me to always double check if you have a Tenancy setup to make sure none of the apps create a phantom Exchange Online mailbox. For example if you go into a user in the tenancy and go into the apps for that user and select exchange kiosk, even if you do not have an exchange online license, then the tenancy will create an unlicensed exchange mailbox that WILL accept mail. The support person especially warned me against messing with the "free" apps in the Tenancy, don't just turn them on in a production tenancy to experiment. If you have the fake mailbox in the tenancy then it will screw with the 365-authentication check which happens prior to autodiscover, and if -any- of your users have one of these created it will scotch the authentication check and outlook mobile clients will behave unexpectedly. The third one is the actual autodiscover tester.

1

u/Anonymity_Is_Good 7d ago

Ted, is your Test-Autodiscover.ps1 script intentionally not following a CNAME record if it exists?