There are often problems reported by users related to connectivity or you just setup your lab and want to know if you configured everything correct. But even when you double-checked and everything looks okay you might want to see what Autodiscover returns for a given user. Maybe not only for a given user, maybe just the result from one specific server or when you have larger environments from servers within a specific AD site.
Of course you can use Outlook and run “Test E-Mail AutoConfiguration”, but for this you need to have Outlook installed. Outlook on a server? Might not be a good idea and anyways not supported to have Outlook installed on an Exchange server.
If you want to send a request to Autodiscover service you can choose between two services:
The main difference is that POX is returning always the complete configuration for a client, while with SOAP you can query individual elements/parts of clients configuration. Besides this POX can send 2 special headers:
- X-MapiHttpCapability: If present and set to “1”, indicates that the client is requesting information that can be used to connect to the server by using the MAPI/HTTP protocol. This header is applicable to clients that implement the MAPI/HTTP protocol
- X-ClientCanHandle: This header contains a comma-delimited list of capabilities that the client supports:
- Negotiate (min. server version 15.00.0995.014)
- ExHttpInfo (min. server version 15.00.0995.014)
Now that we know the basics we can build our own request and parse the result. Therefore I wrote a script, which accepts the following parameters:
|EmailAddress||The required parameter EmailAddress defines the e-mail address for the object we want the configuration.|
|Server||This parameter Server overrides the automation process of finding the Autodiscover endpoint. This is the hostname you will send the request to.|
Note: Cannot be used in combination with FromAD.
|Credentials||The parameter Credentials accepts PSCredential objects, which are used for authentication. If omitted and no OAuth is used, the scripts runs in the context of the executing user.|
|SOAP||The parameter SOAP will cause to send SOAP requested instead of POX.|
|FromAD||The parameter FromAD will cause the script to query AD for SCP in order to find the Autodiscover endpoint. Note: Cannot be used in combination with Server.|
|ADSite||The parameter ADSite defines which ADSite will be queried. Note: Can only be used in combination with FromAD.|
|Timeout||The parameter Timeout defines the Timeout of the request.|
|TrustAll||The parameter TrustAll will disable certificate check.|
|UseOAuth||The parameter UseOAuth will trigger OAuth2 auth code flow for authentication.|
|RawResponse||The parameter RawResponse will return the raw response.|
How to use?
You just need to download the script from GitHub here. As we are all moving away from Basic authentication, I added the support of using OAuth2.0 for authorization and authentication. In fact I’m using the well-known application, which is used by C2R. If you still want to use Basic auth you can use the parameter Credentials or none, which then uses the default network credential.
Here some screenshots:
With the support of OAuth2.0 I wanted to make the script capable for scenarios, where Basic authentication is not available.
I hope this helps troubleshooting. Any feedback is highly appreciated.