I want to delete 90 days older disconnected mailbox from Exchange 2013 server.

asked 2021-04-15T18:18:35.337+00:00
Sanjay 21 Reputation points

Want to delete 90 days older disabled mailbox from exchange 2013 environment. I know cmd to remove all the disabled mailboxes. but can you advise if any script available to delete 90 days older mailbox not all

Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
6,072 questions
No comments
{count} votes

Accepted answer
  1. answered 2021-04-16T03:04:26.557+00:00
    Kael Yao-MSFT 21,501 Reputation points Microsoft Employee

    Hi @Sanjay

    By default, the retention period of disabled mailboxes on each database in Exchange 2013 is 30 days.
    It means disabled mailboxes which are older than 30 days will be removed automatically.

    If you have changed the default setting and would like to manually delete the disabled mailboxes which are 90 days older.
    You may use this command to first list all these disable mailboxes:

    Get-MailboxDatabase | foreach {Get-MailboxStatistics -Database $_.DistinguishedName} | where {$_.DisconnectReason -eq "Disabled"} | where {$_.DisconnectDate -le (get-date).adddays(-90)} | fl DisplayName,Database,DisconnectDate  

    And run this command to remove the disabled mailboxes:

    Get-MailboxDatabase | foreach {Get-MailboxStatistics -Database $_.DistinguishedName} | where {$_.DisconnectReason -eq "Disabled"} | where {$_.DisconnectDate -le (get-date).adddays(-90)} | ForEach {Remove-StoreMailbox –Database $_.database –identity $_.mailboxguid –MailboxState Disabled}  

    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    No comments

0 additional answers

Sort by: Most helpful