Hello,
I need to delete all messages that are older than 90 days from a mailbox which includes inbox and all subfolders. So this is what I have. I don't have a test environment, so will need to run this in Prod and schedule it to run daily. Even though it looks straighforward, it is doing a delete, so am a litte paranoid :). Can you guys please verify if it looks ok?
$daysback = (Get-Date).adddays(-90)
Search-Mailbox abc@abc.com –SearchQuery “Received:< $($daysback)” –DeleteContent
Thanks