Exchange Autodiscover is deceptively simple. Until it doesn’t work. Then, repairing autodiscover can be surprisingly challenging.
Microsoft does provide the Microsoft Connectivity Analyzer which can (among other things) give you detailed information about your autodiscover situation. However, it works “from the outside to the inside”. This PowerShell allows you to work “from the inside to the outside”.
The script below allows you to test autodiscover to a specific server. If it succeeds, but your overall autodiscover fails, then you have a far reduced set of things to investigate, in order to repair your autodiscover deployment. This script will allow you to test internally or externally (given that your firewall/router has the appropriate NAT forwarding/translation rules and DNS is properly configured). If an internal test succeeds, but an external test fails – this points you to load-balancer/firewall/router. If the internal test fails – then you may have several items to check. Read the source of the script below for the most common issues.
I am developing a script that works “the same way” as Outlook is documented to work for autodiscover – with more insight to the various steps. While I have it working today, it’s not a pretty script. 🙂 I will post it when it is more clean.
### your real autodiscover host, the responses will be the same.
### of the Microsoft provided tools give you that flexibility.
### all three of username, password, and emailAddress.
### of the script. Look below.
### This is not a list of all possible issues.
### will attempt to figure out what is going on. However - no promises.
throw "You must provide a hostname"
$str = Read-Host "Enter username for request"
throw "You must provide a username"
$str = Read-Host -AsSecureString "Enter password for $username"
throw "You must provide a password"
$str = Read-Host "Enter email address for $username"
throw "You must provide an emailaddress"
$autoDiscoverRequest = $autoDiscoverRequest.Replace( "`t", '' )  ### remove tab characters from the autodiscoverrequest. Exchange doesn't like those tabs.
### the computer is on a LAN or connected via a VPN or connected via DirectAccess).
### separated by a colon. That's all. Never use except with SSL!
### autodiscover has knowledge about user-agents. i found that surprising.
write-error "Webpage response is empty."
Previous PostPrevious PowerShell Quick Script: Would You Like to Play a Game?