Quantcast
Channel: Exchange Server 2013 - Administration, Monitoring, and Performance 论坛
Viewing all articles
Browse latest Browse all 8719

Search-Mailbox Item Count Zero

$
0
0

The goal is to export monthly content to pst and then delete content from journaling mailboxes for a given date range.  I have found a very handy powershell script to do all of this, however the delete content step does not work.  

 This step in the script is what is failing:  

$endDate = Get-Date -Day 1 "00:00:00"
$startDate = $endDate.AddMonths(-1)
$month = "{0:D2}" -f [int]$startDate.Month

# Convert dates to short date strings
$endDate = $endDate.ToShortDateString()
$startDate = $startDate.ToShortDateString()

Get-Mailbox -Identity "intjournal.mailbox" | Search-Mailbox -SearchQuery "Received:'${startDate}'..'${endDate}'" -DeleteContent

I have added to the Exchange Admin role group 'Organization Management' the 'Mailbox Search' and the 'Mailbox Import Export' roles to this group, of which my user object is a member.  

I can even try a manual search and deletecontent by simply running this:  ( which fails to return anything but '0' in the 'ResultItemsCount' field)

  Search-Mailbox -Identity intjournal.mailbox -SearchQuery "Received:02/01/2015..02/28/2015" -deletecontent -force

Everything I have read today indicates that this script should work.  Am I missing a management role assignment on my user object that is preventing the search from finding / deleting messages?   Is there something different about a journaling mailbox that requires special parameters?   Any help here would be great, I hate having to add more disk space while I figure this out!

Thanks In Advance,

Chris J.



Viewing all articles
Browse latest Browse all 8719

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>