grahamr975 / EWS-Office365-Contact-Sync

Uses Exchange Web Services to synchronize a Global Address List in Office 365 to a user's mailbox
MIT License
96 stars 21 forks source link

The Autodiscover service couldn't be loaded #27

Open ThunderBandit opened 3 years ago

ThunderBandit commented 3 years ago

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 xx@xx.dk. Exception on calling "AutodiscoverURL" with "2" arguments: The Autodiscover service couldn't be located.

grahamr975 commented 3 years ago

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

excidium78 commented 3 years ago

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. »

kiwipeti commented 3 years ago

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

marcellaven commented 3 years ago

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

grahamr975 commented 3 years ago

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

marcellaven commented 3 years ago

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!

Backmischung commented 3 years ago

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 my.name@domain.de'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 my.name@domain.de 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!

jestergi commented 3 years ago

I too have the issue with autodiscover.

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

zookato commented 3 years ago

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