EWS-Office365-Contact-Sync icon indicating copy to clipboard operation
EWS-Office365-Contact-Sync copied to clipboard

The Autodiscover service couldn't be loaded

Open ThunderBandit opened this issue 4 years ago • 9 comments

When I try to run the script and to the part where it start to load the EWSContact module. I get the following error: ERROR Failed to Sync-Contactlist for [email protected]. Exception on calling "AutodiscoverURL" with "2" arguments: The Autodiscover service couldn't be located.

ThunderBandit avatar Dec 07 '20 09:12 ThunderBandit

@ThunderBandit what's your Exchange environment? Online? On-premise? Hybrid? I know that people have reported issues with on-premise exchange.

grahamr975 avatar Dec 10 '20 17:12 grahamr975

Hi i have the same error with my single mailbox test :( I'm using Exchange Online.

"ERROR Failed to Sync-ContactList for user Exception lors de l'appel de « AutodiscoverUrl » avec « 2 » argument(s) : « The Autodiscover service couldn't be located. »

excidium78 avatar Feb 16 '21 15:02 excidium78

I received the same error with hybrid Exchange 2016. Any suggestion?

kiwipeti avatar Feb 18 '21 21:02 kiwipeti

Same error message here! Hybrid Exchange 2016 setup. Autodiscover to on-prem server, all mailboxes in Office365.

marcellaven avatar Mar 10 '21 13:03 marcellaven

Unfortunately, I cannot test this issue in my own environment. Can someone with Exchange on-prem try changing line 74 of Connect-EXCExchange.ps1 to their version of Exchange server and let me know if this works?

$ExchangeVersion = [Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2010_SP2

grahamr975 avatar Mar 10 '21 14:03 grahamr975

Never mind!! It's already working! I've done the following: On my management server I have edited the HOSTS file (Windows\system32\drivers\etc) and add the following line. (Don't do that on the live Exchange server!!)

52.97.176.40 autodiscover.owndomein.com

IP address is one of the addresses resolved from autodiscover.outlook.com

Now the script can find the autodiscover service of Office365 and it's working like a charm!

marcellaven avatar Mar 10 '21 14:03 marcellaven

Greetings,

i was also getting this error after our last Exchange Update (the Hafnium-Security-Update (05.03.21) through WindowsUpdate).

AUSFÜHRLICH: Funktion "Write-AdminAuditLog" wird importiert. 2021.03.12 14:03:11 INFO Beginning contact sync for [email protected]'s mailbox AUSFÜHRLICH: Using EWS dll from Local Directory AUSFÜHRLICH: Using Modern Auth AUSFÜHRLICH: Modul wird aus Pfad ".\EWS-Office365-Contact-Sync-master\EWSContacts\Module\bin\Microsoft.IdentityModel.Clients.ActiveDirectory.dll" geladen. 2021.03.12 14:03:12 ERROR Failed to Sync-ContactList for [email protected] Ausnahme beim Aufrufen von "AutodiscoverUrl" mit 2 Argument(en): "The Autodiscover service couldn't be located."

(the interesting parts are in english so i didn´t translate them)

We´re having a hybrid setup. Our Autodiscover can be found regularly and also shows no errors (checked via: https://testconnectivity.microsoft.com/tests/O365Ola/input )

@grahamr975 ive tried to change line 74 of Connect-EXCExchange.ps1 to $ExchangeVersion = [Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2016

After this i also tried to check the suggestion of @marcellaven After switching the hosts-file it also worked again for me and was able to locate the autodiscover-service.

Thanks for your help guys!

Backmischung avatar Mar 12 '21 14:03 Backmischung

I too have the issue with autodiscover.

2021/04/23 11:02:19 ERROR Failed to Sync-ContactList for [email protected] Exception calling "AutodiscoverUrl" with "2" argument(s): "The Autodiscover service couldn't be located."

  • I'm currently in hybrid mode.
  • My autodiscover URL is currently still pointed to an on-premise device (a load balancer)
  • The machine I'm running the script from resolves the autodiscover URL to the internal IP of that device.
  • I did try editing Connect-EXCExchange.ps1 and changed EX2010_SP2 to EX2016 to match my on-premise environment, but got the same error (also tried EX2016_CU16 just in case).
  • I also added a hosts file entry for the outlook.com autodiscover, but still didn't have luck.

jestergi avatar Apr 23 '21 15:04 jestergi

Hi,

Has fixed with me, Run this to allow secure connection [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls11,Tls12'

Then add those to hosts file as per you domain IP 150.105.150.30 autodiscover.Domain.Com 150.105.150.30 webmail.Domain.Com 150.105.150.30 Domain.Com

zookato avatar Jun 09 '21 12:06 zookato