I am a firm believer that everything in Windows Server 2012 R2 that can be done in the GUI can also be done in PowerShell. Case in point, I just upgraded one of our network Domain Controllers from Windows Server 2012 to Windows Server 2012 R2.
Since this server was a DC the first thing I needed to do before the upgrade was to ensure the server was not running any of the five FSMO roles on our network. To do this I ran the following command in PS on the server.
netdom query FSMOThis will return which DC or DCs on your network contain the FSMO roles. Since the server I was upgrading had none then I had none to move before the upgrade. Once the upgrade had completed I now wanted to make sure the newest DC on the network had the roles while others were being upgraded.
To transfer all five roles you can simply run this command in PS:
Move-ADDirectoryServerOperationMasterRole -Identity “Target_DC_name” –OperationMasterRole 0,1,2,3,4For reference the command line syntax replaces the role number for the full name of the FSMO role.
- PDC Emulator = 0
- RID Master = 1
- Infrastructure Master = 2
- Schema Master = 3
- Domain Naming Master = 4
Move-ADDirectoryServerOperationMasterRole -Identity “Target_DC_name” –OperationMasterRole 0,1,2,3,4 - ForceFinally to transfer or seize just one role you would run the exact same command and just use the number of the role you need to move. These commands work on Server 2008 R2 and up or Windows 7 with the RSAT (Remote Server Administration Tools) installed.
I don't find myself moving FSMO roles often but when I need to this is much easier than using the GUI. A great reference on PowerShell is Learn Windows PowerShell 3 in a Month of Lunches. It's a great read and has tons of great PowerShell information.