<# .SYNOPSIS This script will move FSMO roles to a specified domain controller. .DESCRIPTION This script will move FSMO roles to a specified domain controller. It prompts the user for confirmation before proceeding with the role transfer. The script retrieves the current FSMO roles and displays them, then moves the roles to the specified domain controller. It also retrieves and displays the FSMO roles at both the domain and forest levels. .EXAMPLE Move-FSMORoles This example runs the script and prompts the user to confirm the transfer of FSMO roles. If confirmed, it moves the roles to the specified domain controller. .EXAMPLE Move-FSMORoles -Identity "yourDCname.yourdomain.net" This example runs the script and moves the FSMO roles to the specified domain controller without prompting for confirmation. .INPUTS The Microsoft .NET Framework types of objects (if any) that can be piped to the function or script. You can also include a description of the input objects. .OUTPUTS The Microsoft .NET Framework type of the objects that the cmdlet returns (if any). You can also include a description of the returned objects. .NOTES This script is used for moving FSMO roles in an Active Directory environment. Ensure you have the necessary permissions to move FSMO roles. The script will prompt for confirmation before proceeding with the role transfer. The output will display the current FSMO roles and the roles after the transfer. #> #FSMO Roles array $roles = @( "PDCEmulator", "RIDMaster", "InfrastructureMaster", "SchemaMaster", "DomainNamingMaster" ) $Proceed = Read-Host "Are you sure you want to move FSMO roles? Type 'Yes' to proceed" if ($Proceed -eq 'Yes') { Move-ADDirectoryServerOperationMasterRole -Identity "DCName.yourdomain.net" -OperationMasterRole $roles -Confirm:$false Move-ADDirectoryServerOperationMasterRole -Identity "DCName2.yourdomain.net" -OperationMasterRole $roles } else { Write-Host "Roles have not been moved." } #Get FSMO roles at the domain level: PDC Emulator, RID Master, and Infrastructure Master. Get-ADDomain | Select-Object PDCEmulator, RIDMaster, InfrastructureMaster #Get FSMO roles at the forest level: Schema Master and Domain Naming Master Get-ADForest | Select-Object SchemaMaster, DomainNamingMaster