Getting the error System.OutOfMemory Exception in some powershell scripts

Welcome Forums General PowerShell Q&A Getting the error System.OutOfMemory Exception in some powershell scripts

  • This topic has 1 reply, 2 voices, and was last updated 11 months ago by
    Participant
    .
Viewing 1 reply thread
  • Author
    Posts
    • #206181
      Participant
      Topics: 1
      Replies: 0
      Points: 11
      Rank: Member

      I have  a runbook designed for doing some tasks in specific AD accounts. Of many tasks , I am facing problem in three specific powershell scripts which are failing. The three scripts do the following tasks respectively:-

      • Disable ActiveSync
      • Check for out of office Status
      • Remove all rules and alerts

      I get the error as “System.OutOfMemory” exception for the scripts , when considerably a higher number of records are processed by the orchestrator , say 30 records. Out of which 24 would get processed seamlessly and other 6 would faily for no reason.

      The records are fetched from the database all at once , and all the subsequent tasks/ nodes are executed for all the records parallely and not by fetching records one by one and processing each record individually. I think the RAM consumption is getting very high whenever the number of records for processing is high.

      I am attaching the snapshots of the three scripts for your reference :-

      The snapshots attached below are of the Scripts being used , where I am facing the issue.

      Any suggestion / observation would be of great help. Thank You!

      ————————————————————————————————————————————————————–

      • This topic was modified 11 months ago by kvprasoon. Reason: code formatting
    • #206187
      Participant
      Topics: 10
      Replies: 2480
      Points: 6,537
      Helping Hand
      Rank: Community MVP

      Please format your code as code using the code tag button named “PRE”.

      When you corosspost the same question at the same time to different forums you should at least post links to the other forums along with question to avoid people willing to help you making their work twice or even more.

      https://social.technet.microsoft.com/Forums/en-US/9b69aa86-2cc3-45c4-bb0b-68a4dfb21361/systemoutofmemory-exception-occuring-intermittently?forum=winserverpowershell

Viewing 1 reply thread
  • The topic ‘Getting the error System.OutOfMemory Exception in some powershell scripts’ is closed to new replies.