How it works...

When you use the Remove-Mailbox or Disable-Mailbox cmdlets to delete a mailbox for a user, that mailbox can actually be retained in its source database for a period of time. This is determined by the deleted mailbox retention setting of the database the mailbox resides in. For example, let's say that the deleted mailbox retention for the database hosting the testuser mailbox is set to 30 days. After the testuser mailbox has been deleted, this gives us 30 days to reconnect that mailbox to an Active Directory user account before the retention period is met and the mailbox is permanently purged.

The -Identity parameter, used with the Connect-Mailbox cmdlet, specifies the mailbox that should be connected to an Active Directory ...

Get Microsoft Exchange Server 2016 PowerShell Cookbook - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.