Search-Mailbox between dates
Hi, I'm trying to delete mail's in my mailbox within a certain period of time, but when I run the command always get the same error: Command: Search-Mailbox -id "UserName" -SearchQuery "*" -StartDate "1-1-2010" -EndDate "1-2-2010" -DeleteContent Error: Search Failed on mailbox 'OrganizationName\UserName\70abe9b9-df5d-1289-bd80-d5d08c8758cc'. If the search query used shor t words with wildcard(s) such as pat*, it can result in a large number of words or phrases because all permutations of words starting with "pat" are searched. Make search queries as specific as possible when using wildcards. + CategoryInfo : ReadError: (0:Int32) [Search-Mailbox], SearchMailboxException + FullyQualifiedErrorId : C8A70864,Microsoft.Exchange.Management.Tasks.SearchMailbox Any Ideias?! Thanks!
March 21st, 2011 10:01am

The -SearchQuery is optional, if you dont use it, it will automaticly grab all the mail in your mailbox, so there is no need to do a "*". So just run Search-Mailbox -id "UserName" -StartDate "1-1-2010" -EndDate "1-2-2010" -DeleteContentDJ Grijalva | MCITP: EMA 2007/2010 | www.persistentcerebro.com
Free Windows Admin Tool Kit Click here and download it now
March 21st, 2011 11:00am

DJ Grijalva, Thanks for the reply. I got the following error: [PS] C:\>Search-Mailbox -id "UserName" -StartDate "1-1-2010" -EndDate "1-2-2010" -DeleteContent A positional parameter cannot be found that accepts argument '-StartDate'. + CategoryInfo : InvalidArgument: (:) [Search-Mailbox], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Search-Mailbox
March 21st, 2011 11:04am

Try with search query Search-Mailbox -id "user" -SearchQuery "Received:11/05/04..11/10/04"With kind regards Krystian Zieja http://www.projectnenvision.com Follow me on twitter My Blog
Free Windows Admin Tool Kit Click here and download it now
March 21st, 2011 12:03pm

Krystian, I get the same error: Error: Search Failed on mailbox 'OrganizationName\UserName\70abe9b9-df5d-1289-bd80-d5d08c8758cc'. If the search query used shor t words with wildcard(s) such as pat*, it can result in a large number of words or phrases because all permutations of words starting with "pat" are searched. Make search queries as specific as possible when using wildcards. + CategoryInfo : ReadError: (0:Int32) [Search-Mailbox], SearchMailboxException + FullyQualifiedErrorId : C8A70864,Microsoft.Exchange.Management.Tasks.SearchMailbox
March 21st, 2011 12:45pm

Thanks to a technical support from MSFT, he suggested the following: New-MailboxSeach -Name "SearchTeste" -StartDate "1/1/2011" -EndDate "12/31/2011" -TargetMailbox "UserName" -SearchQuery "'something'" Search-Mailbox -Identity "UserName" -SearchQuery "Subject:'Hello'" -TargetMailbox "UserName" -TargetFolder "teste" -LogLevel Full -DeleteContent References: http://technet.microsoft.com/en-us/library/ff459253.aspx and http://technet.microsoft.com/en-us/library/dd298173.aspx http://technet.microsoft.com/en-us/library/dd353189.aspx and http://msexchangeteam.com/archive/2010/11/29/457071.aspx
Free Windows Admin Tool Kit Click here and download it now
March 23rd, 2011 12:42am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics