[玩转系统] 如何在 Exchange Server 上启用维护模式
作者:精品下载站 日期:2024-12-14 23:34:45 浏览:15 分类:玩电脑
如何在 Exchange Server 上启用维护模式
在本文中,我们将向您展示如何正确地将 Exchange Server 2019/2016 主机置于维护模式。如果要在 Exchange Server 主机上安装更新(Windows 更新或 Exchange CU)或维护服务器硬件,则必须将数据库可用性组 (DAG) 置于维护模式。启用维护模式时,必须将活动数据库移出 Exchange 服务器并将队列切换到其他服务器。
Exchange Server 有两个内置的 PowerShell 脚本用于管理维护模式:
StartDagServerMaintenance.ps1 - 允许将活动数据库和主活动管理器 (PAM) 角色移动到另一台服务器,并阻止邮箱数据库的反向迁移,直到维护结束;
StopDagServerMaintenance.ps1 - 允许您通过执行相反的过程使 Exchange 服务器退出维护模式。
这些脚本位于 Scripts 文件夹 (
CD $ExScripts
) Exchange 安装目录。使用以下语法:
.\StartDagServerMaintenance.ps1 -ServerName <ServerName> -MoveComment Maintenance -PauseClusterNode
.\StopDagServerMaintenance.ps1 -serverName <ServerName>
这些脚本使您能够自动执行某些操作。在大多数情况下,Exchange 管理员更喜欢手动将服务器置于维护模式。
有一个 PowerShell 脚本示例,您可以使用它来启用 Exchange 服务器的维护模式。在安装了 Exchange 命令行管理程序和 RSAT 群集模块的计算机上运行命令:
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn
Import-Module FailoverClusters
或者您可以使用 PowerShell 远程连接到 Exchange Server:
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://munexh01.a-d.site/PowerShell/ -Authentication Kerberos -Credential (Get-Credential)
Import-PSSession $Session
设置 Exchange 服务器的名称:
# a server that you want to enable the maintenance mode for
$maintance_srv = "munexh01.a-d.site"
# a target server you want to move mail queues to
$target_srv = "munexh02.a-d.site"
# Disable the HubTransport component of the server and put it into Draining mode
Set-ServerComponentState $maintance_srv -Component HubTransport -State Draining -Requester Maintenance
Restart-Service MSExchangeTransport
# Check that the HubTransport status has changed to Draining
Get-ServerComponentState -Identity $maintance_srv -Component Hubtransport
如果你跑
Get-ServerComponentState -Identity $maintance_srv
现在,所有 Exchange 组件(Monitoring 和 RecoveryActionsEnabled 除外)都将处于非活动状态。
# Move mail queue to another server
Redirect-Message -Server $maintance_srv -Target $target_srv
# Make sure that the mail queue have been cleared:
Get-Queue
# Pause your cluster node. This will move the Primary Active Manager (PAM) role to another DAG host
Suspend-ClusterNode -Name $maintance_srv
# Move all the mounted copies of mailbox databases to other servers
Set-MailboxServer $maintance_srv -DatabaseCopyActivationDisabledAndMoveNow $true
# Prevent a database activation on the server
Set-MailboxServer $maintance_srv -DatabaseCopyAutoActivationPolicy Blocked
等待邮箱数据库成功移动到另一台主机(这将需要几分钟)。确保服务器上已安装的数据库列表为空:
Get-MailboxDatabaseCopyStatus -Server $maintance_srv | where {$_.Status -like "Mounted"}
# Put Exchange components into maintenance mode
Set-ServerComponentState $maintance_srv -Component ServerWideOffline -State InActive -Requester Maintenance
# Check if the server is in maintenance mode
Get-ServerComponentState -Identity $maintance_srv -Component ServerWideOffline
Get-MailboxDatabaseCopyStatus
现在您可以完成所需的 Exchange 主机的维护过程。在服务器上完成所有操作后,您需要执行相反的步骤以使 Exchange Server 主机退出维护模式:
Set-ServerComponentState $maintance_srv -Component ServerWideOffline -State Active -Requester Maintenance
# You may check the status as shown below (it must change to Active):
Get-ServerComponentState $maintance_srv -Component ServerWideOffline
Resume-ClusterNode -Name $maintance_srv
Set-MailboxServer $maintance_srv -DatabaseCopyAutoActivationPolicy Unrestricted
Set-MailboxServer $maintance_srv -DatabaseCopyActivationDisabledAndMoveNow $false
Set-ServerComponentState $maintance_srv -Component HubTransport -State Active -Requester Maintenance
检查 Exchange 服务器状态:
Test-ServiceHealth $maintance_srv
使用 RedistributeActiveDatabases.ps1 根据配置的激活首选项在 DAG 主机之间重新平衡活动邮箱数据库:
cd $exscripts
.\RedistributeActiveDatabases.ps1 -DagName mun-dag -BalanceDbsByActivationPreference
如果要将邮箱数据库的所有活动副本从一台服务器移动到另一台服务器,请运行以下命令:
Move-ActiveMailboxDatabase -Server $target_srv -ActivateOnServer $maintance_srv -Confirm:$false
执行 MAPI 可用性检查:
Test-MAPIConnectivity -Server $maintance_srv
检查 DAG 中的数据库状态和复制:
Get-MailboxDatabaseCopyStatus
Test-ReplicationHealth -DatabaseAvailabilityGroup
猜你还喜欢
- 03-30 [玩转系统] 如何用批处理实现关机,注销,重启和锁定计算机
- 02-14 [系统故障] Win10下报错:该文件没有与之关联的应用来执行该操作
- 01-07 [系统问题] Win10--解决锁屏后会断网的问题
- 01-02 [系统技巧] Windows系统如何关闭防火墙保姆式教程,超详细
- 12-15 [玩转系统] 如何在 Windows 10 和 11 上允许多个 RDP 会话
- 12-15 [玩转系统] 查找 Exchange/Microsoft 365 中不活动(未使用)的通讯组列表
- 12-15 [玩转系统] 如何在 Windows 上安装远程服务器管理工具 (RSAT)
- 12-15 [玩转系统] 如何在 Windows 上重置组策略设置
- 12-15 [玩转系统] 如何获取计算机上的本地管理员列表?
- 12-15 [玩转系统] 在 Visual Studio Code 中连接到 MS SQL Server 数据库
- 12-15 [玩转系统] 如何降级 Windows Server 版本或许可证
- 12-15 [玩转系统] 如何允许非管理员用户在 Windows 中启动/停止服务
取消回复欢迎 你 发表评论:
- 精品推荐!
-
- 最新文章
- 热门文章
- 热评文章
[短剧] 2025年06月03日 精选+付费短剧推荐25部
[软件合集] 25年6月3日 精选软件44个
[短剧合集] 2025年06月2日 精选+付费短剧推荐39部
[软件合集] 25年6月2日 精选软件18个
[软件合集] 25年6月1日 精选软件15个
[短剧合集] 2025年06月1日 精选+付费短剧推荐59部
[短剧] 2025年05月31日 精选+付费短剧推荐58部
[软件合集] 25年5月31日 精选软件66个
[电影] 黄沙漫天(2025) 4K.EDRMAX.杜比全景声 / 4K杜比视界/杜比全景声
[风口福利] 短视频红利新风口!炬焰创作者平台重磅激励来袭
[剧集] [央视][笑傲江湖][2001][DVD-RMVB][高清][40集全]李亚鹏、许晴、苗乙乙
[电视剧] 欢乐颂.5部全 (2016-2024)
[电视剧] [突围] [45集全] [WEB-MP4/每集1.5GB] [国语/内嵌中文字幕] [4K-2160P] [无水印]
[影视] 【稀有资源】香港老片 艺坛照妖镜之96应召名册 (1996)
[剧集] 神经风云(2023)(完结).4K
[剧集] [BT] [TVB] [黑夜彩虹(2003)] [全21集] [粤语中字] [TV-RMVB]
[资源] B站充电视频合集,包含多位重量级up主,全是大佬真金白银买来的~【99GB】
[影视] 内地绝版高清录像带 [mpg]
[书籍] 古今奇书禁书三教九流资料大合集 猎奇必备珍藏资源PDF版 1.14G
[美图] 2W美女个美女小姐姐,饱眼福
[电视剧] [突围] [45集全] [WEB-MP4/每集1.5GB] [国语/内嵌中文字幕] [4K-2160P] [无水印]
[剧集] [央视][笑傲江湖][2001][DVD-RMVB][高清][40集全]李亚鹏、许晴、苗乙乙
[电影] 美国队长4 4K原盘REMUX 杜比视界 内封简繁英双语字幕 49G
[电影] 死神来了(1-6)大合集!
[软件合集] 25年05月13日 精选软件16个
[精品软件] 25年05月15日 精选软件18个
[绝版资源] 南与北 第1-2季 合集 North and South (1985) /美国/豆瓣: 8.8[1080P][中文字幕]
[软件] 25年05月14日 精选软件57个
[短剧] 2025年05月14日 精选+付费短剧推荐39部
[短剧] 2025年05月15日 精选+付费短剧推荐36部
- 最新评论
-
- 热门tag