How to Fix Exchange Online PowerShell Out-of-Memory Errors
Question details
The user needs to resolve an intermittent PSRemotingTransportException out-of-memory error that occurs when utilizing a C# connector with Exchange Online PowerShell.

- Product
- Exchange Online
- Device & OS
- not provided
- Scenario
- Running the Get-MailboxAutoReplyConfiguration cmdlet to process lists of mailbox IDs via a C# connector.
- Observed behavior
- The system throws a PSRemotingTransportException indicating an out-of-memory error, even when processing relatively small lists of approximately 100 objects.
Ensure you are using the latest version of the ExchangeOnlineManagement PowerShell module (V3) and verify that your local execution environment has sufficient memory available.
Seek Assistance on Microsoft Q&A
Because this is an enterprise-level issue involving deep Exchange Online backend behavior and PowerShell Remoting limits, consulting Microsoft specialists is recommended.
Exchange Online imposes strict resource limits on remote PowerShell sessions. When standard client-side optimizations fail to prevent PSRemotingTransportException errors, the issue must be investigated by Microsoft's backend engineering team.
Open your web browser and go to the official Microsoft Q&A platform at https://learn.microsoft.com/en-us/answers/.
When creating a new post, ensure you add tags for 'Exchange Online' and 'PowerShell' so that the appropriate Microsoft support specialists and community experts see your question.
Include your C# connector code snippet, the exact PSRemotingTransportException stack trace, and mention that it fails specifically on Get-MailboxAutoReplyConfiguration even with small batches of 100 objects.

Implement Smaller Batch Processing in C#
Reduce the memory payload per session by batching requests into smaller chunks before passing them to the PowerShell runspace.
Boost Your Daily Productivity with WPS Office
While enterprise IT issues like Exchange Online server errors require specialized administration, your daily document tasks shouldn't be a hassle. WPS Office is a free, lightweight, and user-friendly alternative to Microsoft Office, designed to keep your workflow smooth and efficient.
- 1. Download the installer: Visit the official WPS Office website and click the download button for your operating system.
- 2. Install the suite: Run the downloaded installer and follow the on-screen instructions to complete the setup.
- 3. Open your documents: Launch WPS Office and directly open any existing Microsoft Word, Excel, or PowerPoint files without losing formatting.

Frequently Asked Questions
Why does Get-MailboxAutoReplyConfiguration trigger a PSRemotingTransportException?
This typically occurs when the background IIS process handling PowerShell remoting in Exchange Online hits a memory threshold. It is often caused by the heavy XML serialization required to transport complex auto-reply configuration objects over WinRM.
Can I increase the PowerShell memory limit for my Exchange Online tenant?
No, Exchange Online is a managed SaaS environment. Tenants cannot modify the MaxMemoryPerShellMB quota on the server side as they could in on-premises Exchange. You must optimize your client-side scripts to use less memory per session.
How can I avoid memory leaks in my C# PowerShell connector?
Ensure you are explicitly calling runspace.Dispose() and PowerShell.Dispose() in your C# code after executing commands. Relying solely on the .NET garbage collector may lead to intermittent out-of-memory errors and runspace exhaustion during high-frequency API calls.




