禁用或删除邮箱Exchange ServerDisable or delete a mailbox in Exchange Server

在Exchange Server中,可以使用 Exchange 管理中心 (EAC) Exchange 命令行管理程序 禁用或删除邮箱。In Exchange Server, you can use the Exchange admin center (EAC) or the Exchange Management Shell to disable or delete mailboxes. 禁用或删除的邮箱也称为断开连接 的邮箱Disabled or deleted mailboxes are also known as disconnected mailboxes. 有关断开连接的邮箱详细信息,请参阅断开连接 的邮箱For more information about disconnected mailboxes, see Disconnected mailboxes.

注意:如果需要删除 Microsoft 365 或 Office 365 中的邮箱,请参阅删除 或还原 Exchange Online中的用户邮箱。Note: If you need to delete a mailbox in Microsoft 365 or Office 365, see Delete or Restore User Mailboxes in Exchange Online.

在开始之前,您需要知道什么?What do you need to know before you begin?

提示

遇到问题?请访问以下 Exchange 论坛寻求帮助:Exchange ServerExchange OnlineExchange Online ProtectionHaving problems? Ask for help in the Exchange forums. Visit the forums at: Exchange Server, Exchange Online, or Exchange Online Protection.

禁用邮箱Disable mailboxes

禁用邮箱时,将从 Active Directory 中的关联用户帐户中删除所有 Exchange 属性。When you disable a mailbox, all Exchange attributes are removed from the associated user account in Active Directory. 断开连接的邮箱被隐藏并标记为删除。The disconnected mailbox is hidden and marked for removal. 断开连接的邮箱将 (邮箱) 邮箱数据库的 MailboxRetention 属性值清除 (默认值为 30 天) 。The disconnected mailbox is permanently deleted (purged) based on the MailboxRetention property value for the mailbox database (the default value is 30 days). 在清除邮箱之前,可以重新连接到没有关联邮箱的新用户帐户或现有用户帐户。Before the mailbox is purged, you can reconnect it to a new or existing user account that doesn't already have an associated mailbox. 有关详细信息,请参阅 连接禁用的邮箱For more information, see Connect a disabled mailbox.

注意:禁用具有关联存档的邮箱会同时标记主邮箱和存档邮箱以删除。Note: Disabling a mailbox that has an associated archive marks both the primary and archive mailboxes for removal. 若要仅在不影响主邮箱的情况下将存档邮箱标记为删除,请参阅 禁用存档邮箱To only mark the archive mailbox for removal without affecting the primary mailbox, see Disable an archive mailbox.

使用 EAC 禁用邮箱Use the EAC to disable a mailbox

  1. 在 EAC 中,转到" 收件人", 然后单击要禁用的邮箱类型的选项卡:In the EAC, go to Recipients, and click the tab for the type of mailbox that you want to disable:

    • 用户 邮箱和链接邮箱的邮箱。Mailboxes for user mailboxes and linked mailboxes.

    • 共享 邮箱。Shared for shared mailboxes.

  2. 查找并选择要禁用的邮箱。Find and select the mailbox that you want to disable. 例如:For example:

    • 滚动浏览列表。Scroll through the list. 您还可以单击列标题对邮箱进行排序。You can also click the column headers to sort the mailboxes.

    • 单击 " 搜索",然后输入文本以筛选邮箱列表。Click Search and enter the text to filter the list of mailboxes.

    • 选择多个邮箱,选择一个邮箱,按住 Shift 键,然后选择列表中向下移动的邮箱,或在选择每个邮箱时按住 Ctrl 键。Select multiple mailboxes by selecting a mailbox, holding the Shift key, and selecting a mailbox farther down in the list, or by holding down the CTRL key as you select each mailbox.

  3. 选择要禁用的邮箱后,单击"更多选项"图标,选择"禁用",然后在出现的警告消息中单击"  是"。 After you've selected the mailbox or mailboxes that you want to disable, click More More Options icon, select Disable, and then click Yes in the warning message that appears.

使用 Exchange 命令行管理程序 禁用邮箱Use the Exchange Management Shell to disable a mailbox

若要禁用邮箱,请使用以下语法:To disable a mailbox, use this syntax:

Disable-Mailbox <MailboxIdentity> [-Arbitration] [-Archive] [-PublicFolder] [-RemoteArchive]

本示例禁用别名值为 danj 的用户邮箱。This example disables the user mailbox that has the alias value danj.

Disable-Mailbox danj

本示例禁用名为 Conf Room 31/1234 (12) 。This example disables the room mailbox named Conf Room 31/1234 (12).

Disable-Mailbox "Conf Room 31/1234 (12)"

本示例禁用电子邮件地址为 sharedmbx@contoso.com。This example disables the shared mailbox that has the email address sharedmbx@contoso.com.

Disable-Mailbox sharedmbx@contoso.com

有关语法和参数的详细信息,请参阅 Disable-MailboxFor detailed syntax and parameter information, see Disable-Mailbox.

如何判断是否生效?How do you know this worked?

若要验证是否成功禁用了邮箱,请执行下列任一步骤:To verify that you've successfully disabled a mailbox, do any of these steps:

  • 在 EAC 中,单击" 收件人",转到禁用的邮箱类型的相应选项卡,并验证该邮箱是否不再列出。In the EAC, click Recipients, go to the appropriate tab for the type of mailbox that you disabled, and verify that the mailbox is no longer listed. 请注意,您可能需要单击"刷新 刷新  "图标 Note that you might need to click Refresh Refresh icon.

  • 在 Active Directory 用户和计算机中,右键单击已禁用邮箱的用户帐户,然后单击“属性”。In Active Directory Users and Computers, right-click the user account whose mailbox you disabled, and then click Properties. "常规 "选项卡上,验证 "电子邮件"字段 是否为空。On the General tab, verify that the E-mail field is blank.

  • 在 Exchange 命令行管理程序 中,将 替换为用户的 显示名称,并运行以下命令来验证 <DisplayName> DisconnectReason 属性值是否为 (该值指示邮箱已标记为 Disabled) :In the Exchange Management Shell, replace <DisplayName> with the user's display name, and run the following commands to verify the DisconnectReason property value is Disabled (which indicates the mailbox has been marked for removal):

    $dbs = Get-MailboxDatabase
    $dbs | foreach {Get-MailboxStatistics -Database $_.DistinguishedName} | where {$_.DisplayName -eq "<DisplayName>"} | Format-List DisconnectReason,DisconnectDate
    

    注意Notes:

    • DisconnectReason 属性不区分已禁用和已删除的邮箱 (两者的值都 Disabled) 。The DisconnectReason property doesn't distinguish between disabled and deleted mailboxes (the value for both is Disabled). 存在关联的用户帐户指示邮箱是否已禁用。The presence of the associated user account indicates whether the mailbox was disabled.

      删除邮箱时 ,DisconnectReason 属性的值也是 ,但相应的 Disabled Active Directory 用户帐户也会被删除。When you delete a mailbox, the value of the DisconnectReason property is also Disabled, but the corresponding Active Directory user account is also deleted.

    • 如果该命令未返回任何结果,请将 替换为断开连接的邮箱所在的邮箱数据库的名称,然后运行此命令同步数据库中所有断开连接的邮箱的邮箱 <DatabaseName> 状态:If the command returns no results, replace <DatabaseName> with the name of the mailbox database where the disconnected mailbox resides, and run this command to synchronize the mailbox state for all disconnected mailboxes on the database:

    Get-MailboxStatistics -Database "<DatabaseName>" | foreach {Update-StoreMailboxState -Database $_.Database -Identity $_.MailboxGuid -Confirm:$false}
    

    然后,运行上一个命令,现在该命令应返回结果。Then, run the previous command, which should now return results.

  • 在 Exchange 命令行管理程序 中,将 替换为用户名称或用户主体名称 (例如 user@contoso.com) ,并运行此命令来验证 RecipientType 属性值是 , <UserIdentity> User 而不是 UserMailboxIn the Exchange Management Shell, replace <UserIdentity> with the name or user principal name of the user (for example, user@contoso.com), and run this command to verify that the RecipientType property value is User, not UserMailbox.

    Get-User -Identity <UserIdentity>
    

删除邮箱Delete mailboxes

删除邮箱时,该邮箱会与关联的用户帐户断开连接,并且该帐户将从 Active Directory 中删除。When you delete a mailbox, the mailbox is disconnected from the associated user account, and the account is removed from Active Directory. 断开连接的邮箱被隐藏并标记为删除。The disconnected mailbox is hidden and marked for removal. 断开连接的邮箱将 (邮箱) 邮箱数据库的 MailboxRetention 属性值清除 (默认值为 30 天) 。The disconnected mailbox is permanently deleted (purged) based on the MailboxRetention property value for the mailbox database (the default value is 30 days). 在清除邮箱之前,可以重新连接到没有关联邮箱的新用户帐户或现有用户帐户。Before the mailbox is purged, you can reconnect it to a new or existing user account that doesn't already have an associated mailbox. 有关详细信息,请参阅 连接或还原已删除的邮箱For more information, see Connect or restore a deleted mailbox.

注意:删除具有关联的存档的邮箱会同时标记主邮箱和存档邮箱以删除。Note: Deleting a mailbox that has an associated archive marks both the primary and archive mailboxes for removal. 若要仅在不影响主邮箱的情况下将存档邮箱标记为删除,请参阅 禁用存档邮箱To only mark the archive mailbox for removal without affecting the primary mailbox, see Disable an archive mailbox.

使用 EAC 删除邮箱Use the EAC to delete a mailbox

  1. 在 EAC 中,转到要删除的邮箱类型的位置:In the EAC, go to the location for the type of mailbox that you want to delete:

    • 收件人 >用户 邮箱和链接邮箱的邮箱。Recipients > Mailboxes for user mailboxes and linked mailboxes.

    • 收件人 >会议室 和设备邮箱的资源。Recipients > Resources for room and equipment mailboxes.

    • 收件人 >共享 邮箱。Recipients > Shared for shared mailboxes.

    • 公用文件夹 >公用文件夹邮箱 的公用文件夹邮箱。Public folders > Public folder mailboxes for public folder mailboxes.

  2. 查找并选择要禁用的邮箱。Find and select the mailbox that you want to disable. 例如:For example:

    • 滚动浏览列表。Scroll through the list. 您还可以单击列标题对邮箱进行排序。You can also click the column headers to sort the mailboxes.

    • 单击 " 搜索",然后输入文本以筛选邮箱列表。Click Search and enter the text to filter the list of mailboxes.

    • 选择多个邮箱,选择一个邮箱,按住 Shift 键,然后选择列表中向下移动的邮箱,或在选择每个邮箱时按住 Ctrl 键。Select multiple mailboxes by selecting a mailbox, holding the Shift key, and selecting a mailbox farther down in the list, or by holding down the CTRL key as you select each mailbox.

  3. 选择要删除的一个或多个邮箱后,单击"删除删除"图标,然后在出现的警告消息中单击"  是"。After you've selected the mailbox or mailboxes that you want to delete, click Delete Delete icon, and then click Yes in the warning message that appears.

使用Exchange 命令行管理程序删除邮箱Use the Exchange Management Shell to delete a mailbox

若要删除邮箱,请使用以下语法:To delete a mailbox, use this syntax:

Remove-Mailbox <MailboxIdentity> [-Arbitration] [-PublicFolder]

本示例删除电子邮件地址为 pilarp@contoso.com。This example deletes the mailbox that has the email address pilarp@contoso.com.

Remove-Mailbox pilarp@contoso.com

本示例将删除名为"一号 16 ("的设备) 。This example deletes the equipment mailbox named Fleet Van (16).

Remove-Mailbox "Fleet Van (16)"

本示例删除别名值为 corpprint 的邮箱。This example deletes the mailbox that has the alias value corpprint.

Remove-Mailbox corpprint

有关语法和参数的详细信息,请参阅 Remove-MailboxFor detailed syntax and parameter information, see Remove-Mailbox.

注意:如果将 Remove-Mailbox cmdlet 与 Purge 开关一同使用,则邮箱将立即清除且不可恢复。Note: If you use the Remove-Mailbox cmdlet with the Purge switch, the mailbox is immediately purged and isn't recoverable. 有关详细信息,请参阅永久删除邮箱For more information, see Permanently delete a mailbox.

如何判断是否生效?How do you know this worked?

若要验证是否成功删除了邮箱,请执行下列任一步骤:To verify that you've successfully deleted a mailbox, do any of these steps:

  • 在 EAC 中,单击" 收件人",转到已删除的邮箱类型的相应选项卡,并验证该邮箱是否不再列出。In the EAC, click Recipients, go to the appropriate tab for the type of mailbox that you deleted, and verify that the mailbox is no longer listed. 请注意,您可能需要单击"刷新 刷新  "图标 Note that you might need to click Refresh Refresh icon.

  • 在"Active Directory 用户和计算机"中,验证关联的帐户是否不再列出。In Active Directory Users and Computers, verify that the associated account is no longer listed. 请注意,除用户和链接邮箱外,邮箱类型还具有禁用关联的用户帐户 (例如会议室、设备、仲裁、共享和公用文件夹邮箱) 。Note that mailbox types other than user and linked mailboxes also have associated user accounts that are disabled (for example, room, equipment, arbitration, shared, and public folder mailboxes).

  • 在 Exchange 命令行管理程序 中,将 替换为用户的 显示名称,并运行以下命令来验证 <DisplayName> DisconnectReason 属性值是否为 (该值指示邮箱已标记为 Disabled) :In the Exchange Management Shell replace <DisplayName> with the user's display name, and run the following commands to verify the DisconnectReason property value is Disabled (which indicates the mailbox has been marked for removal):

    $dbs = Get-MailboxDatabase
    $dbs | foreach {Get-MailboxStatistics -Database $_.DistinguishedName} | where {$_.DisplayName -eq "<DisplayName>"} | Format-List DisconnectReason,DisconnectDate
    

    注意Notes:

    • DisconnectReason 属性不区分已禁用和已删除的邮箱 (两者的值都 Disabled) 。The DisconnectReason property doesn't distinguish between disabled and deleted mailboxes (the value for both is Disabled). 缺少关联的用户帐户指示邮箱是否已删除。The absence of the associated user account indicates whether the mailbox was deleted.

    • 如果该命令未返回任何结果,请将 替换为已断开连接的邮箱所在的邮箱数据库的名称,然后运行以下命令同步数据库中所有断开连接的邮箱的邮箱 <DatabaseName> 状态:If the command returns no results, replace <DatabaseName> with the name of the mailbox database where the disconnected mailbox resides, and run the following command to synchronize the mailbox state for all disconnected mailboxes on the database:

      Get-MailboxStatistics -Database "<DatabaseName>" | foreach {Update-StoreMailboxState -Database $_.Database -Identity $_.MailboxGuid -Confirm:$false}
      

      然后,运行上一个命令,现在该命令应返回结果。Then, run the previous command, which should now return results.

  • 在 Exchange 命令行管理程序 中,将 替换为用户名或用户主体名称 (例如 user@contoso.com) ,然后运行此命令验证找不到 <UserIdentity> 用户。In the Exchange Management Shell, replace <UserIdentity> with the name or user principal name of the user (for example, user@contoso.com), and run this command to verify that the user can't be found.

    Get-User <UserIdentity>
    

更多信息More information

当您删除与邮箱关联的 Active Directory 用户帐户时,Exchange 将检测到该邮箱不再连接到用户帐户,并且将邮箱标记为删除,即使邮箱已置于诉讼保留或 In-Place 保留状态。When you delete the Active Directory user account that's associated with a mailbox, Exchange will detect that the mailbox is no longer connected to a user account, and will mark the mailbox for removal, even if the mailbox has been placed on Litigation Hold or In-Place Hold. 若要保留邮箱,请执行以下步骤:To retain the mailbox, do these steps:

  • 禁用用户帐户,而不是删除用户帐户。Instead of deleting the user account, disable the user account.

  • 更改邮箱的属性以限制其使用以及有权访问邮箱的用户。Change the properties of the mailbox to restrict its use and who has access to the mailbox. 例如,将发送和接收配额设置为等于 1,阻止谁可以将邮件发送到邮箱,并限制谁可以访问邮箱。For example, set send and receive quotas equal to 1, block who can send messages to the mailbox, and restrict who has access the mailbox.

  • 保留此邮箱,直到擦除所有数据或直到不再需要保留数据为止。Retain the mailbox until all data has been expunged, or until preserving the data is no longer required.

有关详细信息,请参阅 In-Place Hold and Litigation Hold in Exchange ServerFor more information, see In-Place Hold and Litigation Hold in Exchange Server.