Forum Discussion
ADumith
Feb 15, 2023Iron Contributor
Search and delete emails content
Hello everyone,
I need to develop a script to maintain the mailboxes of my users when they are over quota.
I had found this:
Search-Mailbox myTarget -SearchQuery '(recieved<02/01/2003) AND (recieved>02/14/2023) AND (kind:email)'
But I understand that this command has been deprecated, so I was wondering if any of you could guide me on how to do the search (I still need to add another parameter) and eliminate the emails that meet this criteria.
Thank you in advance,
- The cmdlet is still available and works fine, and it's faster/more convenient than the "replacement" New-ComplianceSearch one. But in your scenario, it's probably easier if you just stamp a retention policy on the mailbox: https://learn.microsoft.com/en-us/exchange/security-and-compliance/messaging-records-management/retention-tags-and-policies