PowerShell – Move AD FSMO Roles in Server 2012

Over the long weekend we worked on two projects:

  1. Upgrade the Hyper-V hosts on the cluster at the data center
  2. Finish prepping a new Hyper-V host and Domain Controller for a new branch office with a new subnet

imageSince the cluster at the data center holds all of the Active Directory FSMO roles we needed to transfer the roles to an alternate location on the MPLS network so that project 1 didn’t slow down or stop project 2.

PowerShell to the rescue!

WHICH SERVER HOLDS THE FSMO ROLES?

Open PowerShell as an Administrator and type:

netdom query fsmo

You’ll see each of the 5 FSMO roles and which domain controller holds them.

Using PowerShell to transfer FSMO roles

The 5 FSMO roles are numbered 0-4:

0 – PDCEmulator
1 – RIDMaster
2 – InfrastructureMaster
3 – SchemaMaster
4 – DomainNamingMaster

Why do we care what those numbers are? Because we can move the FSMO roles very quickly and save a lot of typing.

For example, which PowerShell command is easier to type?

Move-ADDirectoryServerOperationMasterRole -Identity “Target-DC” -OperationMasterRole SchemaMaster,RIDMaster,InfrastructureMaster,DomainNamingMaster,PDCEmulator

Or this one?

Move-ADDirectoryServerOperationMasterRole -Identity "Target-DC" -OperationMasterRole 0,1,2,3,4

Personally, if you’re moving all the roles at once to the same DC (like when doing some server maintenance) the 0,1,2,3,4 is easy.

Once you type in either of those commands you are prompted with several options for confirmation.

Y, A, N, L, S or ?

Moving FSMO roles with PowerShell

OPTIONS:

If you choose “Y” for Yes, PowerShell will prompt you to move each role,
then move to the next role, like this.

PowerShell FSMO role transfer - individual confirmation

If you choose “N” for No, PowerShell will skip transferring that role.

If you choose “A” for All, PowerShell will try to transfer all 5 roles to Target-DC.

If the transfer of a FSMO role fails PowerShell will let you know loud and clear.

PowerShell FSMO role transfer message

CONFIRMATION:

Unfortunately, if the transfer is successful you basically don’t get any confirmation of the role transfer.

You’ll need to run NETDOM QUERY FSMO to double-check who has the roles.
NETDOM QUERY FSMO to double-check FSMO role location

Side note – Once nice thing about using PowerShell to transfer the FSMO roles is that you can script the transfer to run at a scheduled time (so you don’t forget to put the roles back where they should be later).

Also, I didn’t have to load the Active Directory PowerShell module – Windows Server 2012 does that for me automatically.

VN:F [1.9.20_1166]
Rating: 9.4/10 (84 votes cast)
PowerShell - Move AD FSMO Roles in Server 2012, 9.4 out of 10 based on 84 ratings

19 Replies to “PowerShell – Move AD FSMO Roles in Server 2012”

  1. Great article. If you wanted to use PowerShell exclusively, this cmdlet will replace the NETDOM command (I'm not saying its better, just an alternative)

    Get-ADDomainController -Filter { OperationMasterRoles -ne ""} | Select HostName, OperationMasterRoles | Format-Table -AutoSize

  2. Works great, just some extra info: if your current RID is down or not recoverable anymore, just add -Force at the end of this command in powershell and it still does the trick.

  3. The other way to check the successful transfer is to look for Event 1458 in the Directory Service log on the target DC.

    Each of the FSMO roles that were moved should log its own 1458 event.

Leave a Reply