Solved

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

Posted on 2014-10-23
3
613 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 41

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

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As cyber crime continues to grow in both numbers and sophistication, a troubling trend of optimization has emerged over the last year.
Enabling the Skype for Business Meeting Scheduler in Hybrid OWA
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

729 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