Change UPN-Suffix

Change UPN-Suffix

Import-Module ActiveDirectory
$oldSuffix = “update.net”
$newSuffix = “bunthoeurn”
$filter = “*@” + $oldSuffix
echo $filter
Get-ADUser -Filter {UserPrincipalName -like $filter} |
ForEach-Object {
$UPN = $_.UserPrincipalName.Replace($oldSuffix,$newSuffix)
Set-ADUser $_ -UserPrincipalName $UPN
}

Leave a Reply

Your email address will not be published. Required fields are marked *