FSMO Role Transfer

FSMO Role transfer via GUI is a huge task and it is simplified in some sets of commands. I have created a choice pattern in which you can which role you prefer to send from one DC to another.

How it works

Usually the scripts ask to provide the preference from 1-6, which role you want to send to the other DC. Likewise if we do with GUI it is a huge task, so it is very easy in powershell. In this scripts if the transfer is successful you will get a prompt if the role is successfully transfered.

Probable outcome

After you run this script you will be able to transfer the roles from one DC to another ad you can check as well. FSMO roles is a very important hence do it very carefully.

Script

Provide the destination DC in which you want to transfer the fsmo role

$destinationdc= Read-Host “Provide the Destination domain controller”

Choose the role you want to transfer

$role=read-host “Choose the role”
Switch($role)
{

1 { $result = ‘DomainNamingMaster’}
2 { $result = ‘PDCEmulator’}
3 { $result = ‘RIDMaster’}
4 { $result = ‘SchemaMaster’}
5 { $result = ‘InfrastructureMaster’}
6 {$result = ‘All’}
}

if($role -gt 6)

{
Write-host “Choose correct option” -ForegroundColor Cyan

}

This will transfer DomainNamingMaster role to destination server

if ($role -eq 1)
{

Move-ADDirectoryServerOperationMasterRole -OperationMasterRole DomainNamingMaster -Identity $destinationDc -confirm:$false

Write-host “$result is transferred successfully to $destinationDc” -ForegroundColor DarkGreen -BackgroundColor Cyan

netdom query fsmo |Select-String “Domain Naming Master”
}

This will transfer PDCEmulator role to destination server

if ($role -eq 2)
{

Move-ADDirectoryServerOperationMasterRole -OperationMasterRole PDCEmulator -Identity $destinationDc -confirm:$false

Write-host “$result is transferred successfully to $destinationDc” -ForegroundColor DarkGreen -BackgroundColor Cyan

netdom query fsmo |Select-String “PDC”
}

This will transfer RID pool manager role to destination server

if ($role -eq 3)
{

Move-ADDirectoryServerOperationMasterRole -OperationMasterRole RIDMaster -Identity $destinationDc -confirm:$false

Write-host “$result is transferred successfully to $destinationDc” -ForegroundColor DarkGreen -BackgroundColor Cyan

netdom query fsmo |Select-String “RID pool manager”
}

This will transfer Schema Master role to destination server

if ($role -eq 4)
{

Move-ADDirectoryServerOperationMasterRole -OperationMasterRole SchemaMaster -Identity $destinationDc -confirm:$false

Write-host “$result is transferred successfully to $destinationDc” -ForegroundColor DarkGreen -BackgroundColor Cyan

netdom query fsmo |Select-String “Schema Master”
}

This will transfer Infrastructure Master role to destination server

if ($role -eq 5)
{

Move-ADDirectoryServerOperationMasterRole -OperationMasterRole InfrastructureMaster -Identity $destinationDc -Credential -confirm:$false

Write-host “$result is transferred successfully to $destinationDc” -ForegroundColor DarkGreen -BackgroundColor Cyan

netdom query fsmo |Select-String “Infrastructure Master”
}

This will transfer All roles to destination server

if ($role -eq 6)
{

Move-ADDirectoryServerOperationMasterRole -OperationMasterRole DomainNamingMaster,PDCEmulator,RIDMaster,SchemaMaster,InfrastructureMaster -Identity $destinationDc -confirm:$false

Write-host “$result roles are transferred successfully to $destinationDc” -ForegroundColor DarkGreen -BackgroundColor Cyan

netdom query fsmo
}


Leave a comment