trying to delete content from sent item mailbox by date
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn;$mbx = get-mailbox "username"$targettime = (Get-Date).adddays(-180).ToString("MM/dd/yyyy HH:mm")Do { $result = Search-Mailbox -Identity $mbx.Identity -SearchQuery {Sent:"01/01/2000 10:00..$targettime"} -DeleteContent -force -WarningAction Silentlycontinuewrite-host $result.resultitemscount -ForegroundColor Green } Until ($result.resultitemscount -eq 0)
and getting the error massage:
The KQL parser threw an exception.