先总结一下:

删除Exchange,主要注意先删除Mailbox Database上的mailboxes, mailbox plans, archive mailboxes, public folder mailboxes or arbitration mailboxes, Audit mailboxes,Monitoring mailbox

要删除arbitration mailboxes,先要删除默认的Offline Address Books

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn;

Get-MailboxDatabase -Status | Sort Name | Format-Table Name, Server, Mounted

Get-Mailbox -Database "ExDB01" | Disable-Mailbox

Get-OfflineAddressBook | Remove-OfflineAddressBook

Get-Mailbox -Database "ExDB01" -Arbitration | Disable-Mailbox -Arbitration -DisableLastArbitrationMailboxAllowed

Get-Mailbox -Database "ExDB01" -Monitoring | Disable-Mailbox

Get-Mailbox -Database "ExDB01" -AuditLog | Disable-Mailbox

Get-MailboxDatabase| Remove-MailboxDatabase

logoff

d:\Setup.exe /m:uninstall /IAcceptExchangeServerLicenseTerms_DiagnosticDataOFF


1.Uninstall Exchange:

1)d:\Setup.exe /m:uninstall /IAcceptExchangeServerLicenseTerms_DiagnosticDataOFF

Setup can't continue with the uninstall because the powershell (8148) has open files. Close the process, and then

restart Setup.

For more information, visit: http://technet.microsoft.com/library(EXCHG.150)/ms.exch.setupreadiness.ProcessNeedsToBeClosedOnUninstall.aspx

Uninstall can't continue. Errors:

This mailbox database contains one or more mailboxes, mailbox plans, archive mailboxes, public folder mailboxes or arbitration mailboxes, Audit mailboxes. To get a list of all mailboxes in this database, run the command Get-Mailbox -Database <Database ID>. To get a list of all mailbox plans in this database, run the command Get-MailboxPlan. To get a list of archive mailboxes in this database, run the command Get-Mailbox -Database <Database ID> -Archive. To get a list of all public folder mailboxes in this database, run the command Get-Mailbox -Database <Database ID> -PublicFolder. To get a list of all arbitration mailboxes in this database, run the command Get-Mailbox -Database <Database ID> -Arbitration. To get a list of all Audit mailboxes in this database, run the command Get-Mailbox -Database <Database ID> -AuditLog. To disable a non-arbitration mailbox so that you can delete the mailbox database, run the command Disable-Mailbox <Mailbox ID>. To disable an archive mailbox so you can delete the mailbox database, run the command Disable-Mailbox <Mailbox ID> -Archive. To disable a public folder mailbox so that you can delete the mailbox database, run the command Disable-Mailbox <Mailbox ID> -PublicFolder. To disable a Audit mailbox so that you can delete the mailbox database, run the command Get-Mailbox -AuditLog | Disable-Mailbox. Arbitration mailboxes should be moved to another server; to do this, run the command New-MoveRequest <parameters>. If this is the last server in the organization, run the command Disable-Mailbox <Mailbox ID> -Arbitration -DisableLastArbitrationMailboxAllowed to disable the arbitration mailbox. Mailbox plans should be moved to another server; to do this, run the command Set-MailboxPlan <MailboxPlan ID> -Database <Database ID>. It was running the command

'Remove-MailboxDatabase 'CN=ExDB01,CN=Databases,CN=Exchange Administrative Group(FYDIBOHF23SPDLT),CN=Administrative Groups,CN=afd,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=ykx,DC=ai' -whatif'.

For more information, visit: http://technet.microsoft.com/library(EXCHG.150)/ms.exch.setupreadiness.UnwillingToRemoveMailboxDatabase.aspx

The Exchange Server setup operation didn't complete. More details can be found in ExchangeSetup.log located in the

<SystemDrive>:\ExchangeSetupLogs folder.

How uninstall Exchange 2019 on Windows Server Core 2022_Server Core

How uninstall Exchange 2019 on Windows Server Core 2022_Server Core_02

2)Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn;

Get-MailboxDatabase -Status | Sort Name | Format-Table Name, Server, Mounted

How uninstall Exchange 2019 on Windows Server Core 2022_Exchange_03

3)Get-Mailbox -Database "ExDB01"

How uninstall Exchange 2019 on Windows Server Core 2022_Server Core_04

4)Get-MailboxPlan

Get-Mailbox -Database "ExDB01" -Archive

Get-Mailbox -Database "ExDB01" -PublicFolder

5)Get-Mailbox -Database "ExDB01" -Arbitration

How uninstall Exchange 2019 on Windows Server Core 2022_Exchange_05

6)Get-Mailbox -AuditLog

How uninstall Exchange 2019 on Windows Server Core 2022_Exchange_06

7)Get-Mailbox -Database "ExDB01" -Monitoring

How uninstall Exchange 2019 on Windows Server Core 2022_Exchange_07

8) Get-Mailbox -Database "ExDB01" | Disable-Mailbox

How uninstall Exchange 2019 on Windows Server Core 2022_Exchange_08

9) Get-Mailbox -Database "ExDB01" -Arbitration | Disable-Mailbox -Arbitration

How uninstall Exchange 2019 on Windows Server Core 2022_Exchange_09

Confirm

Are you sure you want to perform this action?

Disabling mailbox "ykx.ai/Users/SystemMailbox{1f05a927-9924-43d9-a124-a9385c071733}" will remove the Exchange

properties from the Active Directory user object and mark the mailbox in the database for removal. If the mailbox has

an archive or remote archive, the archive will also be marked for removal. In the case of remote archives, this action

is permanent. You can't reconnect this user to the remote archive again.

[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): a

Disable-Mailbox : Exchange can't disable the mailbox "ykx.ai/Users/SystemMailbox{bb558c35-97f1-4cb9-8ff7-d53741dc928c}"

because one or more Offline Address Books are assigned to it for generation.  Please remove or re-assign those Offline

Address Books before disabling this mailbox.

At line:1 char:47

+ ... ailbox -Database "ExDB01" -Arbitration | Disable-Mailbox -Arbitration

+                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   + CategoryInfo          : NotSpecified: (ykx.ai/Users/Sy...7-d53741dc928c}:ADObjectId) [Disable-Mailbox], Recipien

  tTaskException

   + FullyQualifiedErrorId : [Server=EX01,RequestId=c5f884c7-f319-4583-800d-0a9c00e6d124,TimeStamp=2022/1/30 6:48:53]

   [FailureCategory=Cmdlet-RecipientTaskException] 4A93D1AE,Microsoft.Exchange.Management.RecipientTasks.DisableMail  box

10)Get-OfflineAddressBook | Remove-OfflineAddressBook

How uninstall Exchange 2019 on Windows Server Core 2022_Exchange_10

 Get-Mailbox -Database "ExDB01" -Arbitration | Disable-Mailbox -Arbitration

Disable-Mailbox : Exchange can't disable the arbitration mailbox "ykx.ai/Users/SystemMailbox{bb558c35-97f1-4cb9-8ff7-d5

3741dc928c}" because it's the last one in the organization.

At line:1 char:47

+ ... ailbox -Database "ExDB01" -Arbitration | Disable-Mailbox -Arbitration

+                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   + CategoryInfo          : NotSpecified: (ykx.ai/Users/Sy...7-d53741dc928c}:ADObjectId) [Disable-Mailbox], Recipien

  tTaskException

   + FullyQualifiedErrorId : [Server=EX01,RequestId=5c41d370-66f4-47b6-b62a-d2564a0e9627,TimeStamp=2022/1/30 6:53:18]

   [FailureCategory=Cmdlet-RecipientTaskException] 5F539392,Microsoft.Exchange.Management.RecipientTasks.DisableMail  box

How uninstall Exchange 2019 on Windows Server Core 2022_uninstall_11

11)Get-Mailbox -Database "ExDB01" -Arbitration | Disable-Mailbox -Arbitration -DisableLastArbitrationMailboxAllowed

How uninstall Exchange 2019 on Windows Server Core 2022_Server Core_1212) Get-Mailbox -Database "ExDB01" -Monitoring | Disable-Mailbox

How uninstall Exchange 2019 on Windows Server Core 2022_uninstall_13

13)Get-Mailbox -Database "ExDB01" -AuditLog | Disable-Mailbox

How uninstall Exchange 2019 on Windows Server Core 2022_uninstall_14

14)Get-MailboxDatabase| Remove-MailboxDatabase

How uninstall Exchange 2019 on Windows Server Core 2022_uninstall_15

15)d:\Setup.exe /m:uninstall /IAcceptExchangeServerLicenseTerms_DiagnosticDataOFF

How uninstall Exchange 2019 on Windows Server Core 2022_uninstall_16

16)logoff 

17)重新登陆并重新运行:

d:\Setup.exe /m:uninstall /IAcceptExchangeServerLicenseTerms_DiagnosticDataOFF

How uninstall Exchange 2019 on Windows Server Core 2022_uninstall_17

18)将Exchange相关信息从AD中删除:

a)打开ADSI Edit:

How uninstall Exchange 2019 on Windows Server Core 2022_Exchange_18

b)打开Active Directory Users and Computers 删除相关的用户:

How uninstall Exchange 2019 on Windows Server Core 2022_Server Core_19