Get-ADUser -Filter
{UserPrincipalName -like
“*@domain.local”} -SearchBase “OU=whateverisright,DC=contoso,DC=com”
|
{UserPrincipalName -like
“*@domain.local”} -SearchBase “OU=whateverisright,DC=contoso,DC=com”
|
ForEach-Object {
$UPN =
$_.UserPrincipalName.Replace(“domain.local”,”newdomain.local”)
Set-ADUser
$_ -UserPrincipalName
$UPN
}
Easy as opening a banana, right? https://www.youtube.com/watch?v=nBJV56WUDng 🙂