Forum Discussion
Exchange Online Powershell not connecting in scheduled Task script
- Jan 13, 2025
It took me long time, but after creating a seperate scheduled script (only for testing Exchange Online connection), I finally found the issue.
The new script worked fine, so it had to be something about my old script.As it turned out, we had a Webserver API Call executing before the ExO connect in our script and I assume the connection never closed correctly. After I removed / moved this API call, the script is working fine.
Maybe it was blocking the same socket, which the script uses to connect to Exchange?Probably not really useful for you, but I hope it helps anyway.
Hi,
When I had this problem, I added this command to the beginning of my script to connect.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
After a while, I no longer needed this line forcing the TLS. But I can’t remember what was done to correct that behaviour.
Not working here, Windows Server 2022