Solved

How can I count the number of messages in the EOP quarantine

Posted on 2014-10-23
3
447 Views
Last Modified: 2014-10-24
I need to count how many messages are in the EOP quarantine. using "Get-QuarantineMessage | Measure" is no good because I hit the limits imposed by Microsoft. I'm sure the number if in the hundreds of thousands, much higher than the pagesize parameter will allow.

So, is there a command or script I can run that will return the number of messages quarantined?

Thank you
0
Comment
Question by:cyberleo2000
  • 2
3 Comments
 
LVL 38

Accepted Solution

by:
Vasil Michev (MVP) earned 250 total points
ID: 40400135
If you have that many, you will have to aggregate the results using the Page and PageSize parameters. Something like this:

$Messages = $null  
$Page = 1  
do  
{  
    $CurrMessages = Get-QuarantineMessage -PageSize 5000 -Page $Page
    $Page++  
    $Messages += $CurrMessages  
}  
until ($CurrMessages -eq $null)  

Open in new window



Shamelessly stolen from Alan Byrne's example here: https://gallery.technet.microsoft.com:443/office/Office-365-Mail-Traffic-afa37da1
0
 
LVL 16

Assisted Solution

by:Joshua Grantom
Joshua Grantom earned 250 total points
ID: 40400155
May take a while depending on how many there are...

Vasil's looks much better lol

$i = 0
Get-QuarantineMessage | % { $i = $i + 1}
Write-Host "Number of Messages in Quarantine: $i"

Open in new window

0
 
LVL 16

Expert Comment

by:Joshua Grantom
ID: 40400170
I used the below to test because I dont have exchange but it returned the value 29,300 in less than 20 seconds.

$i = 0
Get-ADComputer -filter * | % { $i = $i+1}
Write-Host $i

Open in new window

0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Exchange server is not supported in any cloud-hosted platform (other than Azure with Azure Premium Storage).
Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
In this video we show how to create an email address policy in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Mail Flow…
To show how to create a transport rule in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Rules tab.:  To cr…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now