Hi everyone.
Can you guys help figure out the script I need to delete voicemail messages in Outlook that are older than X days from Today so I don't have to manually enter the specific date range.
I want to delete specific emails (voicemail) older than 30 days. Here's what I have so far:
Get-Mailbox | Search-Mailbox -SearchQuery 'From:voicemail@contoso.com AND Subject:"Voicemail Message" AND received:past month' -TargetMailbox "helpdesk" -TargetFolder "SearchAndDeleteLog" -logonly -loglevel Full
This script search for emails from the past month, but not exactly 30 days from today. How can I tell it to search for voicemail emails older than 30 days?
Edit: I am aware that the script is just searching for voicemail right now and not executing the -deleteContent. ^_^