According to my powershell code shown, it should delete all items between 90 days ago and yesterday. For example if I ran this now the date range would be 1/29/2014
- 4/28/2014
.
$x = ((get-date).addDays(-90)).ToShortDateString()
$y = ((get-date).addDays(-1)).ToShortDateString()
$xy = "$($x)..$($y)"
Search-Mailbox bunnyb2 -SearchQuery "Received:$xy" -DeleteContent -Force
This is deleting most of the mail it is supposed to. However the mailbox still retains all deleted email up until ((get-date).addDays(-1))
at 7pm. The last 5 hours of email that should be deleted are not.
At first I thought it could be a time conversion issue however the machine I am running the command on is in Central Time USA, and the mailbox server is also Central Time USA.
Also, please do not tell me to do "Search-Mailbox whismj-SearchQuery "Received:<$y" -DeleteContent -Force"
. This is a whole other can of worms for me. While the code execute absolutely nothing is returned or deleted. However when I take off the <
all email that was received yesterday is deleted.