I am into a project of migrating AD users from one forest to another forest. we have two On premises AD forests with Azure AD sync and EOP mailboxes, I want to move some users from forest A to Forest B without affecting mailboxes/mailflow and then Change the UPN of moved users after the move is complete. can someone suggest me proper workaround to accomplish this task. v I tried following and failed .
Import-CSV -Path "c:\users.csv" | ForEach-Object {
$upn = $_.upn
(Get-ADUser -Filter {userprincipalname -eq $upn}).DistinguishedName | Move-ADObject -TargetPath "OU=test,DC=test,DC=com"