Coming Soon: GET-IT: Endpoint Management 1-Day Conference on September 28th at 9:30 AM ET Coming Soon: GET-IT: Endpoint Management 1-Day Conference on September 28th at 9:30 AM ET

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: 

Viewing 1 post (of 1 total)
  • Author
    Posts

  • hormiles
    Member
    #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.

Live Webinar: Active Directory Security: What Needs Immediate Priority!Live on Tuesday, October 12th at 1 PM ET

Attacks on Active Directory are at an all-time high. Companies that are not taking heed are being punished, both monetarily and with loss of production.

In this webinar, you will learn:

  • How to prioritize vulnerability management
  • What attackers are leveraging to breach organizations
  • Where Active Directory security needs immediate attention
  • Overall strategy to secure your environment and keep it secured

Sponsored by: