Forum Discussion
jt8585
Mar 03, 2023Copper Contributor
401 Unauthorized
I'm using the following for powershell to connect to Exchange 2016 and it works most of the time but sometimes i keep on getting 401 unauthorized. I would try running it on the server itself or from...
msExchangeDude
Microsoft
Mar 03, 2023are you creating alot of new ps sessions or just a few? is exchangeserver1 a servername or is that an A record for a load balancer? are you on a terminal server that gets rebooted / logged out of often or are you connecting to a stale terminal server connection? Some of my initial thoughts.
- jt8585Mar 03, 2023Copper ContributorI'm creating 1 session to run some mailbox cleanup via EWS API.
exchangeserver1 = actual server name
I'm rdp'd into the actual exchange server (tried going to server1 to server1 and server1 to server2).
Only this script under this account is behaving this way with compliance rights to delete emails from various mailboxes. Other scripts using other accounts (with less rights) are working as expected.