If your using the EWS Managed API in your PowerShell scripts and you need to do some extended debugging to work out why a script isn't working the way you expect in certain environments you can do this by using Tracing as described in https://docs.microsoft.com/en-us/previous-versions/office/developer/exchange-server-2010/dd633676(v=exchg.80) . What this does once it is enabled is it outputs all the requests and responses that are sent to and from the Exchange server so you can see exactly what is taking place and potentially more information on particular errors that are occurring. So in a EWS Managed API script to enable this you just need to set the TraceEnabled property on the ExchangeService object to true eg $server.TraceEnabled = $true And you will then start seeing traces like the following in the console A much cleaner way of capturing these traces is to configure the EWS Managed API to use a separate log file to log them to a file so you can review them ...
Pushing the Envelope in Messaging and Office 365 Development