Memory is growing with Connect-ExchangeOnline.

Shubham Mishra 0 Reputation points
2023-09-08T13:08:36.6033333+00:00

I am seeing a higher utilization of memory with my code.
I am creating a Runspace and then I am creating a temporary Powershell session for connecting to Exchange online using Connect-ExchangeOnline command. And after every 15mins I am checking that exchange connection token has expired or not using Get-ConnectionInformation. If token is expired I am disconnecting exchange connection using DIsconnect-ExchangeOnline and again connecting to exchange, and in this process my memory is shooting up the memory.
I have also tried disposing runspace after Disconnect-ExchangeOnline but it is not releasing the memory.

Can someone please advice?

Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,373 questions
Exchange Server Development
Exchange Server Development
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Development: The process of researching, productizing, and refining new or existing technologies.
528 questions
Microsoft Exchange
Microsoft Exchange
Microsoft messaging and collaboration software.
455 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,455 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,307 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 44,101 Reputation points
    2023-09-11T14:09:06.5+00:00

    Hello there,

    It would be better if you could share your Code.

    It is possible that using the ExchangeOnlineManagement v3 module takes up to 300MB. It is recommended that you try using the current release: Version 3.2.0

    https://video2.skills-academy.com/en-us/powershell/exchange/exchange-online-powershell-v2?view=exchange-ps#release-notes

    Hope this resolves your Query !!

    --If the reply is helpful, please Upvote and Accept it as an answer–