Powershell进行FSMO角色迁移的方法

本章我们将介绍通过Powershell进行FSMO角色迁移的方法(记得以管理员身份运行Powershell,如果没有执行权限,记得Set-ExecutionPolicy Unrestricted调整执行权限),希望以下内容可以帮到大家。

1、查看当前FSMO角色信息:

查看林范围操作主机角色:
Get-ADForest azureyun.local |ft SchemaMaster,DomainNamingMaster
查看域范围操作主机角色:
Get-ADDomain azureyun.local |ft InfrastructureMaster,Pdcemulator,RidMaster
2、执行域命名主机角色(Domain Naming Master)、RID 主机角色(RID Master)和基础架构主机角色(Infrastructure Master)迁移,根据提示回车确认:

Move-ADDirectoryServerOperationMasterRole -Identity Bdc -OperationMasterRole DomainNamingMaster,InfrastructureMaster,RIDMaster -force
3、通过Powershell分别查看林范围跟域范围操作主机角色,确认迁移操作是否成功:

Get-ADForest azureyun.local |ft SchemaMaster,DomainNamingMaster
Get-ADDomain azureyun.local |ft InfrastructureMaster,Pdcemulator,RidMaster
4、执行架构主机角色(Schema Master)、PDC 模拟主机角色(PDC Emulator)角色迁移,根据提示回车确认:

Move-ADDirectoryServerOperationMasterRole -Identity Bdc -OperationMasterRole SchemaMaster,PDCEmulator -Force
5、此时我们通过Powershell分别查看林范围跟域范围操作主机角色,发现迁移均已成功:

Get-ADForest azureyun.local |ft SchemaMaster,DomainNamingMaster
Get-ADDomain azureyun.local |ft InfrastructureMaster,Pdcemulator,RidMaster
附操作实例图如下:

附快速操作流程:

A、查看当前域控制器名称,并确认当前林范围跟域范围操作主机角色信息:

B、执行Powershell命令对五个角色进行一次性迁移操作:

Move-ADDirectoryServerOperationMasterRole -Identity Major -OperationMasterRole SchemaMaster,DomainNamingMaster,PDCEmulator,InfrastructureMaster,RIDMaster -force
移动操作主机角色
你要将角色"SchemaMaster"移动到服务器"Major.azureyun.local"中吗?
[Y] 是(Y) [A] 全是(A) [N] 否(N) [L] 全否(L) [S] 暂停(S) [?] 帮助 (默认值为"Y"):
移动操作主机角色
你要将角色"DomainNamingMaster"移动到服务器"Major.azureyun.local"中吗?
[Y] 是(Y) [A] 全是(A) [N] 否(N) [L] 全否(L) [S] 暂停(S) [?] 帮助 (默认值为"Y"):
移动操作主机角色
你要将角色"PDCEmulator"移动到服务器"Major.azureyun.local"中吗?
[Y] 是(Y) [A] 全是(A) [N] 否(N) [L] 全否(L) [S] 暂停(S) [?] 帮助 (默认值为"Y"):
移动操作主机角色
你要将角色"InfrastructureMaster"移动到服务器"Major.azureyun.local"中吗?
[Y] 是(Y) [A] 全是(A) [N] 否(N) [L] 全否(L) [S] 暂停(S) [?] 帮助 (默认值为"Y"):
移动操作主机角色
你要将角色"RIDMaster"移动到服务器"Major.azureyun.local"中吗?
[Y] 是(Y) [A] 全是(A) [N] 否(N) [L] 全否(L) [S] 暂停(S) [?] 帮助 (默认值为"Y"):
PS C:>

C、查看当前FSMO角色信息,发现已经迁移成功。

PS C:> Get-ADForest azureyun.local |ft SchemaMaster,DomainNamingMaster
SchemaMaster DomainNamingMaster


Major.azureyun.local Major.azureyun.local
PS C:> Get-ADDomain azureyun.local |ft InfrastructureMaster,Pdcemulator,RidMaster
InfrastructureMaster Pdcemulator RidMaster


Major.azureyun.local Major.azureyun.local Major.azureyun.local

通过图形化、Ntdsutil命令行及Powershell命令三种方法进行FSMO角色迁移,我们发现还是通过Powershell进行迁移操作更简单更快捷,希望可以帮到大家。