Forum Discussion
bala official
Feb 14, 2020Copper Contributor
Error while fetching MessageTrace data using PowerShell
I tried to fetch the Message Trace data for the last 7 days through Power Shell. After getting 3 days of data, we face
Cmdlet-InvalidExpressionException. (Page result exceeds maximum threshold. CATEGORY: InvalidArgument.)
We tried to fetch the data multiple times but we keep facing the error. We couldn't fetch data for more than three days. We get approximately 1.4 million records.
We used the below script to fetch the data,
$Page = 1;do{$CurrMessages = Get-MessageTrace -PageSize 5000 -Page $Page -StartDate (Get-Date).addDays(-7) -EndDate (Get-Date);$Page++;$CurrMessages}until ($CurrMessages -eq $null);
1 Reply
Sort By
- meddiesamuelCopper Contributor
bala official trying breaking the time into chunks.
That is a big time frame for messages and you are going to exceed the page limits.