Hi,
Is bt@Stuff .com the UPN or CN? If it's the CN, and assuming the header of the column is CN, you can rename the contacts like below
$file = "C:\temp\contacts.csv"
Import-Csv -Path $file | ForEach-Object {
$CN = $_.CN
Get-ADObject -LDAPFilter "(&(objectClass=contact)(CN=*$CN*))" -Properties CN | Rename-ADObject -NewName $_.CN.replace("gmail","contoso")
}
Best Regards,
Ian Xue
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.