Unable to delete email from mailbox using powershell

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

Tagged: 

This topic contains 0 replies, has 1 voice, and was last updated by Avatar hormiles 4 months, 3 weeks ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Avatar
    hormiles
    Participant
    #618171

    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
    {D919BA05-46A6-415f-80AD-7E09334BB852}
    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.