I upgraded one domain controller in my home active directory and needed to move all the FSMO the new domain controller. So since I’m really lazy and like quick solutions I check what powershell could help me with. And since I know it should live in the ActiveDirectory
module I decided to list all move commands in that module.
Get-Command -Module ActiveDirectory -Name Move*
So now when we found the Move-ADDirectoryServerOperationMasterRole
we need to decide where we want the roles moved, I want them on my local machine, and given the findings in my earlier blog post about getting the computer name, I choose [system.environment]::Machinename
. So now we know how to name our own computer, so we could just move the roles we are interested in. And since I know what I’m doing I don’t to answer that I’m sure all the time, so I added the -Confirm:$False. The commands for the domain and forest unique roles is:
Domain unique roles:
Move-ADDirectoryServerOperationMasterRole -Identity ([system.environment]::Machinename) -OperationMasterRole RIDMaster -Confirm:$False
Move-ADDirectoryServerOperationMasterRole -Identity ([system.environment]::Machinename) -OperationMasterRole PDCEmulator -Confirm:$False
Move-ADDirectoryServerOperationMasterRole -Identity ([system.environment]::Machinename) -OperationMasterRole InfrastructureMaster -Confirm:$False
Forest unique roles:
Move-ADDirectoryServerOperationMasterRole -Identity ([system.environment]::Machinename) -OperationMasterRole SchemaMaster -Confirm:$False
Move-ADDirectoryServerOperationMasterRole -Identity ([system.environment]::Machinename) -OperationMasterRole DomainNamingMaster -Confirm:$False
or.. Since that gave us 5 lines we really need to be able to do this faster. I want it Faster…
Move all roles:
Move-ADDirectoryServerOperationMasterRole -Identity ([system.environment]::Machinename) -OperationMasterRole PDCEmulator,RIDMaster,InfrastructureMaster,SchemaMaster,DomainNamingMaster -Confirm:$False
Or if that is to long we could short it down by replacing the roles names with their numerical counterparts, but I feel that kills some the readability of the oneliners.