2021年3月8日 星期一

Exchange 2016 Upgrade Cumulative Update

 注意事項:

  1. 升級 Cumulative Update ,若是 DAG 架構,須先暫停 DAG
  2. DAG 內的 成員必須接連升級, 中間相隔不要超過一天
  3. 要用 CMDrun as administrator 權限) 執行,不然會有權限異常,或檔案更新失敗等異常現象
  4. 建議先做備份( Exchange & DC ),避免升級失敗


流程:
Prepare Active Directory and Domains:

Upgrade Cumulative Update 前製作業:

執行 Cumulative Update
  • Setup.exe /IAcceptExchangeServerLicenseTerms /Mode:Upgrade [/DomainController:<ServerFQDN>] [/EnableErrorReporting]
  • Restart the server

Cumulative Update 後製作業:
  • 確認 event logs 是否有 錯誤 或 警告
  • 確認 服務 是否都已啟動
  • Exchange Server 離開 維護模式
  • 檢查 Exchange 是否正常運作




Prepare Active Directory and Domains:

Setup.exe /IAcceptExchangeServerLicenseTerms /PrepareSchema
Setup.exe /IAcceptExchangeServerLicenseTerms /PrepareAD
Setup.exe /IAcceptExchangeServerLicenseTerms /PrepareAllDomains



Upgrade Cumulative Update 前製作業:
Exchange Server 進入 維護模式
(請將 ExchangeServer 更改為 你的Exchange Server 電腦名稱,
ExchangeServer01 更改為 你的Exchange Server 電腦名稱,EXDAG01 更改為 DAG Cluster 名稱 )

## 1. Drain the mail queues on the server --將 Mail Queue 清空
Set-ServerComponentState -Identity ExchangeServer -Component HubTransport -State Draining -Requester Maintenance

## 2. Restart-Service
Restart-Service MSExchangeTransport
Restart-Service MSExchangeFrontEndTransport

## 3. Redirect pending messages to another Mailbox server.
Redirect-Message -Server ExchangeServer.coretronic.com -Target ExchangeServer01.coretronic.com

## 4. 有 DAG 的話,須先從 DAG 停用 Server
Suspend-ClusterNode ExchangeServer

## 5. Move all the active databases off of the server to another DAG member.
Set-MailboxServer ExchangeServer -DatabaseCopyActivationDisabledAndMoveNow $True

## 6. Look at the status of the database auto activation policy. Keep this handy. We will need this when we take the server out of maintenance mode.
Get-MailboxServer ExchangeServer | Select DatabaseCopyAutoActivationPolicy

## 7.Block the server from hosting active database copies
Set-MailboxServer ExchangeServer -DatabaseCopyAutoActivationPolicy Blocked

## 8. 確認目前狀態,是否可以進入 maintenance mode
Get-MailboxDatabaseCopyStatus -Server ExchangeServer | Where {$_.Status -eq "Mounted"}
Get-Queue

## 9. Place the server in maintenance mode.
Set-ServerComponentState ExchangeServer -Component ServerWideOffline -State Inactive -Requester Maintenance

## 確認目前狀態
Get-ServerComponentState ExchangeServer | Select Component, State



  • 關閉防毒軟體 服務
  • 關閉備份軟體 服務
  • 關閉其他軟體 服務 ( MMC、powershell 、監控 )



執行 Cumulative Update
  • Setup.exe /IAcceptExchangeServerLicenseTerms /Mode:Upgrade [/DomainController:<ServerFQDN>] [/EnableErrorReporting]
  • Restart the server




Cumulative Update 後製作業:
  • 確認 event logs 是否有 錯誤 或 警告
  • 確認 服務 是否都已啟動
  • Exchange Server 離開 維護模式
## 1. Take the server out of maintenance mode
Set-ServerComponentState ExchangeServer -Component ServerWideOffline -State
Active -Requester Maintenance

## 2. Unpause the DAG node
Resume-ClusterNode ExchangeServer

## 3. Set the server to allow database copy activation
Set-MailboxServer ExchangeServer -DatabaseCopyActivationDisabledAndMoveNow $False

## 4. Set the database auto activation policy back to its original setting
Set-MailboxServer ExchangeServer -DatabaseCopyAutoActivationPolicy Unrestricted

## 5. Set the hub transport component back to active to allow it to accept connections.
Set-ServerComponentState ExchangeServer -Component HubTransport -State Active -Requester Maintenance

## 6. MS recommends that the transport services be restarted to help this change get picked up immediately.
Restart-Service MSExchangeTransport
Restart-Service MSExchangeFrontEndTransport

## 7. If the server was a DAG member and you moved all the active copies off of the server, you can easily move them back based on mount preference by running the RedistributeActiveDatabases.ps1 script

cd $exscripts
.\RedistributeActiveDatabases.ps1 -DagName "EXDAG01" -BalanceDbsByActivationPreference -SkipMoveSuppressionChecks -Confirm:$false



  • 檢查 Exchange 是否正常運作

Get-queue


Get-ClusterNode ExchangeServer

Get-ClusterNode

Test-ServiceHealth ExchangeServer

Get-ExchangeServer | Test-ServiceHealth

Test-MAPIConnectivity -Server ExchangeServer

Get-ExchangeServer | Test-MAPIConnectivity

Get-MailboxDatabaseCopyStatus -Server "ExchangeServer" | Sort Name | Select Name, Status, Contentindexstate

Get-MailboxDatabaseCopyStatus * | Sort Name | Select Name, Status, Contentindexstate

Test-ReplicationHealth -Server ExchangeServer

Get-DatabaseAvailabilityGroup | Select -ExpandProperty:Servers | Test-ReplicationHealth | Sort Name

Get-MailboxServer ExchangeServer | Select Name, DatabaseCopyAutoActivationPolicy

Get-MailboxServer | Select Name, DatabaseCopyAutoActivationPolicy