MailSniper
MailSniper copied to clipboard
The underlying connection was closed: An unexpected error occurred on a send.
I seem to keep getting this error when attempting to download the GAL
Get-GlobalAddressList : Exception calling "ResolveName" with "1" argument(s): "The request failed. The underlying connection was closed: An unexpected error occurred on a send."
At line:1 char:1
+ Get-GlobalAddressList -OutFile gal.txt -ExchHostname ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-GlobalAddressList], MethodInvocationException
+ FullyQualifiedErrorId : ServiceRequestException,Get-GlobalAddressList
I am supplying ExchHostname
, UserName
, and Password
values. I have also tried several different ExchangeVersion
values without success.
I have also found this article https://learn.microsoft.com/en-us/exchange/clients-and-mobile-in-exchange-online/deprecation-of-basic-authentication-exchange-online As of Oct 1, 2022, Microsoft has deprecated basic authentication for EWS. I assume this is related and the cause of this error? Not positive though. If this is an error from basic auth's deprecation, it might be nice to catch this and print an explanation to console.
Update: I realized there was a -Verbose
flag. It doesn't give much more but it looks like the problem is on bind, during connect, as opposed to after it attempts to gather the GAL.
[*] Using EWS URL https://<URL>/EWS/Exchange.asmx
VERBOSE: Exception calling "Bind" with "2" argument(s): "The request failed. The underlying connection was closed: An unexpected error occurred on a send."
[*] Now attempting to gather the Global Address List. This might take a while...
The aforementioned error immediately follows this