Monitor PowerShell Exchange online limits

Lukasz Mastalerz 41 Reputation points
2021-06-02T08:17:46.643+00:00

Hi,

I'm trying to use PowerShell to extract large amount of data from Exchange Online.
I'm using Get-MessageTrace cmdlet.
As expected I started hitting limits and getting errors like this one:

This operation exceeds the throttling budget for policy part 'LocalTime',
policy value '6000000', Budget type: 'PowerShell'. Suggested backoff time
299912 ms.

Whilst the error is not a surprise I'd like to make sure I'm protected against this type of error and in order to do this and to scale the script dynamically I'd like to be able to monitor usage against existing quotas and suspend/resume the process when it approaches the limit.
Is there a way to check current consumption of resources along with their limits?

There's also a bonus question - is there a better was to extract email metadata from Exchange Online?
(I'm interested in just a basic information like sender, recipient, subject, timestamp, etc.)

Many Thanks,
Lukasz

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.
507 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,361 questions
0 comments No comments
{count} votes

Accepted answer
  1. Vasil Michev 95,096 Reputation points MVP
    2021-06-02T08:53:48.923+00:00

    You cannot, the only way is to capture the warnings and backoff for a while. Here's a script/module that shows you how to handle this: https://github.com/Canthv0/RobustCloudCommand/blob/master/RobustCloudCommand.psm1

    As for other methods, I'm afraid you're stuck with PowerShell. You can try some of the newer cmdlets such as Get-MailDetailATPReport:

    Get-MailDetailATPReport -EventType "Message passed" -StartDate "01 May 2021" -EndDate "15 May 2021" -PageSize 5 -DataSource RealtimePipeline -Direction inbound | fl
    
    0 comments No comments

0 additional answers

Sort by: Most helpful