locked
Wont delete content from mailboxes running this command. Is the syntax correct. It does copy the emails but wont delete. RRS feed

  • Question

  • Hey all, exchange 2010 sp3. tried running this command and it wont delete the content from the mailboxes. It will copy the content. Is there somthing wrong with the syntax.

    v.r

    tiny

    Get-Mailbox -resultsize unlimited | Search-Mailbox -SearchQuery 'Subject: "Not possible to make delivery"', "Sent:8/19/2013", -DeleteContent  -TargetMailbox "cmbx1@sdccd.edu" -TargetFolder "phishusps1" -loglevel full

    Tuesday, August 20, 2013 8:02 PM

Answers

  • Hey Tinyski,

               Looks like a comma snuck in on you. Try this one:

    Get-Mailbox -resultsize unlimited | Search-Mailbox -SearchQuery 'Subject: "Not possible to make delivery"', "Sent:8/19/2013" -TargetMailbox "cmbx1@sdccd.edu" -TargetFolder "phishusps1" -loglevel full -DeleteContent

    -Matt

    • Marked as answer by Tinyski Wednesday, August 21, 2013 6:41 PM
    Tuesday, August 20, 2013 8:39 PM
  • Is the user running the Search-Mailbox Member of Discovery Management group ?

    Run the command:

    New-ManagementRoleAssignment -User UserRunningSearchMailbox -Role "Mailbox Import Export"

    Then try the command removing the comma and that should work:

    Get-Mailbox -resultsize unlimited | Search-Mailbox -SearchQuery 'Subject: "Not possible to make delivery"', "Sent:8/19/2013", -DeleteContent  -TargetMailbox "cmbx1@sdccd.edu" -TargetFolder "phishusps1" -loglevel full


    M.P.K ~ ( Exchange | 2003/2007/2010/E15(2013)) ~~ Please remember to click “Vote As Helpful" if it really helps and "Mark as Answer” if it answers your question, “Unmark as Answer” if a marked post does not actually answer your question. ~~ This Information is provided is "AS IS" and confers NO Rights!!

    • Proposed as answer by PK M Wednesday, August 21, 2013 5:58 PM
    • Marked as answer by Tinyski Wednesday, August 21, 2013 6:41 PM
    Wednesday, August 21, 2013 5:58 PM

All replies

  • Hey Tinyski,

               Looks like a comma snuck in on you. Try this one:

    Get-Mailbox -resultsize unlimited | Search-Mailbox -SearchQuery 'Subject: "Not possible to make delivery"', "Sent:8/19/2013" -TargetMailbox "cmbx1@sdccd.edu" -TargetFolder "phishusps1" -loglevel full -DeleteContent

    -Matt

    • Marked as answer by Tinyski Wednesday, August 21, 2013 6:41 PM
    Tuesday, August 20, 2013 8:39 PM
  • Is the user running the Search-Mailbox Member of Discovery Management group ?

    Run the command:

    New-ManagementRoleAssignment -User UserRunningSearchMailbox -Role "Mailbox Import Export"

    Then try the command removing the comma and that should work:

    Get-Mailbox -resultsize unlimited | Search-Mailbox -SearchQuery 'Subject: "Not possible to make delivery"', "Sent:8/19/2013", -DeleteContent  -TargetMailbox "cmbx1@sdccd.edu" -TargetFolder "phishusps1" -loglevel full


    M.P.K ~ ( Exchange | 2003/2007/2010/E15(2013)) ~~ Please remember to click “Vote As Helpful" if it really helps and "Mark as Answer” if it answers your question, “Unmark as Answer” if a marked post does not actually answer your question. ~~ This Information is provided is "AS IS" and confers NO Rights!!

    • Proposed as answer by PK M Wednesday, August 21, 2013 5:58 PM
    • Marked as answer by Tinyski Wednesday, August 21, 2013 6:41 PM
    Wednesday, August 21, 2013 5:58 PM
  • Hey doug thanks for the response but the answer from matt above fixed it.

    tiny

    Wednesday, October 23, 2013 12:31 AM