Negash
asked on
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?
ASKER
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.
Per Jason Crawford's suggestion, I removed everything after -DeletedContent parameter to no avail.
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.
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.
ASKER
I changed the query as you suggested but not items were found to delete. 0 (zero) ResultItemsCount and (0 bytes) ResultItemsSize
DeleteContent.PNG
DeleteContent.PNG
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.
ASKER
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.
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, RetainDele tedItemsFo r
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.
Check for single item recovery
Get-Mailbox <Name> | FL SingleItemRecoveryEnabled,
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.
ASKER
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?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you!
Open in new window