locked
Powershell script to empty users deleted items? RRS feed

  • Question

  • Hello, I was wondering if there was a powershell script to empty my (or anyone's) deleted items folder.  My deleted items folder has 74022 items in it, but I want to empty it out as by far I have the largest mailbox on our exchange server (about 59 GB).

    I cannot empty it using Outlook cached mode, Outlook online mode, or OWA.  In all instances the client freezes.  I left Outlook online mode frozen overnight and when I returned to work the next morning it was finally unfrozen but had an error message that I cannot delete more than 4000 messages at a time.

    There has to be a powershell script or some other way to delete items within a folder under a mailbox.  Please let me know.

    This is Exchange server 2013 CU6.  I want to clean up my mailbox before moving it into a new Exchange server 2016 CU17 DAG cluster.

    Tuesday, October 3, 2017 11:41 AM

Answers

  • This helped, but what ultimately fixed my problem was a free tool called MFCMAPI. You can search the web for it. I stumbled across similar questions as mine in various online forums and a few posters recommended it.

    So I was able to get my Exchange mailbox from 61GB down to just under 7GB! There was ultimately over 125,000 deleted items for one, that took 51GB all in itself.

    I've since configured a mailbox retention policy. 

    Hooray, I'm no longer the #1 largest mailbox in our organization.  The number 1 person now has 24GB and number 2 has 16GB.  So when I was up there at 61GB, I was WAY in front of the pack.  Now when we migrate mailboxes like mine to our new DAG cluster, it won't take all night long.

    • Marked as answer by KJSTech1 Wednesday, October 4, 2017 12:02 PM
    Wednesday, October 4, 2017 12:02 PM

All replies

  • You could script this with EWS.

    Or

    Create a custom MRM policy, and set a tag to that well known folder to delete all older than X days

    When it has finished processing your mailbox, then your can remove the MRM policy (if wanted).


    Cheers,

    Rhoderick

    Microsoft Senior Exchange PFE

    Blog: http://blogs.technet.com/rmilne  Twitter:   LinkedIn:   Facebook:   XING:

    Note: Posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

    Tuesday, October 3, 2017 1:42 PM
  • Hi KJSTech,

    Try the following command and check if any helps:

    Search-Mailbox -Identity username -SearchQuery '#deleted items#' -DeleteContent

    Note, we need to be assigned both of the following management roles to search for and delete messages in users' mailboxes : Mailbox Search & Mailbox Import Export.

    Best Regards,



    Niko Cheng
    TechNet Community Support


    Please remember to mark the replies as answers.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Wednesday, October 4, 2017 9:33 AM
  • This helped, but what ultimately fixed my problem was a free tool called MFCMAPI. You can search the web for it. I stumbled across similar questions as mine in various online forums and a few posters recommended it.

    So I was able to get my Exchange mailbox from 61GB down to just under 7GB! There was ultimately over 125,000 deleted items for one, that took 51GB all in itself.

    I've since configured a mailbox retention policy. 

    Hooray, I'm no longer the #1 largest mailbox in our organization.  The number 1 person now has 24GB and number 2 has 16GB.  So when I was up there at 61GB, I was WAY in front of the pack.  Now when we migrate mailboxes like mine to our new DAG cluster, it won't take all night long.

    • Marked as answer by KJSTech1 Wednesday, October 4, 2017 12:02 PM
    Wednesday, October 4, 2017 12:02 PM
  • Yes you can do that, but that's too manual for me :)

    Cheers,

    Rhoderick

    Microsoft Senior Exchange PFE

    Blog: http://blogs.technet.com/rmilne  Twitter:   LinkedIn:   Facebook:   XING:

    Note: Posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

    Wednesday, October 4, 2017 2:09 PM