Well known commands but very handy to have them all in one place.
First check where things are currently held..
get-addomain | select InfrastructureMaster, PDCEmulator, RIDMaster
Get-ADForest | select DomainNamingMaster, SchemaMaster
And then these commands to move the roles. my_dc is the name of the DC to which to want to move the roles.
Move-ADDirectoryServerOperationMasterRole -Identity "my_dc" PDCEmulator
Move-ADDirectoryServerOperationMasterRole -Identity "my_dc" RIDMaster
Move-ADDirectoryServerOperationMasterRole -Identity "my_dc" Infrastructuremaster
Move-ADDirectoryServerOperationMasterRole -Identity "my_dc" DomainNamingmaster
Move-ADDirectoryServerOperationMasterRole -Identity "my_dc" SchemaMaster