The following command transfers all FSMO roles to a target domain controller.
Move-ADDirectoryServerOperationMasterRole -Identity “Target_DC_name” –OperationMasterRole PDCEmulator,RIDMaster,InfrastructureMaster,SchemaMaster,DomainNamingMaster
To seize the FSMO roles run the below command, which is the same but with a -Force switch. (which is the same as tranferring, but it doesn’t update the DC database that previously hosted the roles – hence making it unusable – note you shouldn’t reconnect a DC to a domain network after it’s roles have been seized. There may also be some clean up to remove the old AD controller from the remaining AD database).
Move-ADDirectoryServerOperationMasterRole -Identity “Target_DC_name” –OperationMasterRole PDCEmulator,RIDMaster,InfrastructureMaster,SchemaMaster,DomainNamingMaster -Force
Note that both commands should be from a PowerShell window that is run as administrator, and the user account running the commands should be an Enterprise Admin and/or a Schema Admin (AD security groups).