Unable to delete email from mailbox using powershell

Home Forums Messaging Software Exchange 2007 / 2010 / 2013 Unable to delete email from mailbox using powershell


Viewing 1 post (of 1 total)
  • Author
  • Avatar

    Hi I am trying to use Exchange Powershell to delete a message from some mailboxes on an Exchange 2013 server.
    $Mailboxes = “list of users”
    $MailBoxes = Get-Mailbox | fl Alias,Database,RecoverableItemsquota,RecoverableItemsWarningQuota,LitigationHoldEnabled,UseDatabaseQuotaDefaults
    Check to make sure mailboxes are not on litigation hold.
    Returns no mailboxes on litigation hold

    Search for the the email in the mailbox(s)
    $Mailboxes | Get-Mailbox | search-mailbox -SearchQuery { From:”[email protected]” } -EstimateResultOnly
    Returns the mailboxes show that the email is in the mailbox
    Identity : someuser
    TargetMailbox :
    Success : True
    TargetFolder :
    ResultItemsCount : 1
    ResultItemsSize : 34.45 KB (35,280 bytes)

    $Mailboxes | Get-Mailbox | where {$_.SingelItemRecoverEnabled -ne “True”} | ft Name, SingelItemRecoverEnabled
    returns mailbox showing SinggleItemRecoverEnabled is $False or Null for this mailbox.

    Attempt to delete the email from the mailbox with the exact searhquery
    $Mailboxes | Get-Mailbox | search-mailbox -SearchQuery { From:”[email protected]” } -TargetMailbox $targetmailbox -TargetFolder $targetfolder -LogLevel full -DeleteContent -Force
    Identity : someuser
    TargetMailbox : some.company.com/SafeHouse/Service Accounts/DiscoverySearchMailbox
    Success : True
    TargetFolder : \$targetmailbox\-6/27/2019 3:28:50 PM
    ResultItemsCount : 0
    ResultItemsSize : 0 B (0 bytes)

    Anyone have a clue why this woul fail to delete the message

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.