Jump to content

Recommended Posts

Posted

Hi,

 

I am trying to delete all "Sent Items" in one users mailbox from the 1st one received until 31/08/2014 I am running the following command and then checking the log file that is created.

From what I can see it looks as if the Search-Query is looking in all locations and the log file backs this up. Is there anyway I can delete just the content that exists in the users "Sent Items"

for a specific date range.

 

I believe that -SearchQuery "Received:<$('31.08.2014')" needs some work but I cannot locate any info on being able to specify a folder with in the mailbox to search.

 

 

Search-Mailbox -Identity USERNAME -TargetMailbox Administrator -TargetFolder "Report_OUTPUT" -SearchQuery "Received:<$('31.08.2014')" -LogOnly -LogLevel Full

 

 

Search-Mailbox -Identity USERNAME -TargetMailbox Administrator -TargetFolder "REPORT_OUTPUT" -SearchQuery "Sent:> $('2012-09-28') and Sent:< $('2014-08-31')" -LogOnly -LogLevel Full

Posted
The end user has OWA not outlook this means that they acan delete about 50 emails at a time, this is too slow. I would also like to use the cmdlets so that I can script it more widely in future
Posted

Yes make sure to bookmark PowerShell Blogger | Everything powershell and more! and in regards to your question you cannot only search a specific folder. But since you are looking at only Sent Items just use this query which matches your requested 2012-09-28 through 2014-08-31

 

-SearchQuery {sent:09/28/2012..08/31/2014} -DeleteContent -Force which will remove it... or you can also just log it as you have in your example.

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...