DeleteContent

I have deleted messages from a mailbox using the following command (search-mailbox -identity xxxxx -SearchQuery "Received:> $('01/01/2013') and Received:< $('12/31/2014')" -DeleteContent  -LogLevel:full -TargetMailbox etest -TargetFolder Admin). This deleted about 12000 messages from the users mailbox in exchange. I renamed the ost file on the users machine and recreated his outlook profile but all those messages that I thought were deleted are still there. Am I not doing it right?
NegashAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jason CrawfordTransport NinjaCommented:
Remove everything after the -DeleteContent parameter:

search-mailbox -identity xxxxx -SearchQuery "Received:> $('01/01/2013') and Received:< $('12/31/2014')" -DeleteContent

Open in new window

timgreen7077Exchange EngineerCommented:
Have the user to log into OWA and verify if the messages are still present. Also make sure that even though you recreated the outlook profile you care connecting to the new profile and not the old. Make sure you selected the new profile under mail32 in the control panel. See screen shot.

selection
NegashAuthor Commented:
I actually removed the existing "outlook" profile and created a new one. The messages are present in Webmail/OWA as well.

Per Jason Crawford's suggestion, I removed everything after -DeletedContent parameter to no avail.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

timgreen7077Exchange EngineerCommented:
The -deletecontent parameter is all you need in order to delete the mail that matches your criteria. Try to write your query like this:

 
search-mailbox -identity xxxxx -SearchQuery received:>01/01/2013, received:<12/31/2014 -DeleteContent

If you choose you can still add the loglevel if you choose. That will not interfere with the delete.
NegashAuthor Commented:
I changed the query as you suggested but not items were found to delete.  0 (zero) ResultItemsCount and (0 bytes) ResultItemsSize
DeleteContent.PNG
timgreen7077Exchange EngineerCommented:
Ok, so all the items that match that criteria has been deleted it seems. Are you still seeing items in the inbox that match that criteria. i'm sure you have deleted the deleted items bin.
NegashAuthor Commented:
Yes, I have deleted the deleted items bin but the items are still there. I compared the mailbox size before and after running the query in exchange and noticed that it has decreased by almost 6GB. Which led me to believe the messages are deleted in exchange. What I don't understand is, how/why they still appear in webmail  and outlook.
timgreen7077Exchange EngineerCommented:
Is the mailbox on litigation hold, in place hold or is single item recovery enabled?

Check for single item recovery
Get-Mailbox <Name> | FL SingleItemRecoveryEnabled,RetainDeletedItemsFor

Check for litigation hold
Get-Mailbox <name> | FL LitigationHoldEnabled

Check for In PlaceHold
Get-Mailbox ,name. | FL InPlaceHolds

If the mail is still in the deleted items folder just try to delete it again. there is nothing to stop you from deleting the mail from that folder.

Also check if there are any retention policies applied to the mailbox. If the mail was deleted it should no longer show in OWA.
NegashAuthor Commented:
No LitigationHold, InPlaceHold, or retention policy for this mailbox. However,  SingleItemsRecoveryEnabled is True and RetainDeletedItemsFor is set for 30days. Does that mean, once the deleted item retention period expires, those messages will disappear?
timgreen7077Exchange EngineerCommented:
Yes that is correct. Once the retention days for single item recovery are expired the mail will purge. Also see below link if you have questions about enabling or disabling single item recovery. But that is why you still see the mail.

https://technet.microsoft.com/en-us/library/ee633460(v=exchg.160).aspx

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NegashAuthor Commented:
Thank you!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Exchange

From novice to tech pro — start learning today.