Change Display name Bulk

berketjune2012 371 Reputation points
2021-09-15T21:36:29.613+00:00

Hi I have a csv with the following headings:

Emailaddress, Current Display Name, New Display Name

What I'm trying to do is change the current ad display name to a new one.

Can someone suggest a powershell command that will import the csv file and make the change on AD on prem

I'm guessing it will have to use the emailaddress column since this is the attribute that is unique to identify the user to change.

Thanks

Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
6,062 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Dave Patrick 426.3K Reputation points MVP
    2021-09-16T03:03:05.4+00:00

  2. Limitless Technology 39,461 Reputation points
    2021-09-16T14:26:35.357+00:00

    Hello @berketjune2012

    You can use the next script to update the display names, but needs some tunning depending on your file name and location and the name of colums (text within <>)

    $UserCount = 0  
      
    Import-Csv -Path <C:\MyADUsers.csv> | ForEach-Object {  
      
    $UPN = $_.<Name>  
    Write-Host “Working on user:” $UPN  
    Get-ADUser -Filter {Name -Eq $UPN} | Set-AdUser -Name $_.EmailAddress  
    $usercount = $usercount +1  
    }  
    Write-Host “Total users on your CSV: $UserCount”  
    Write-Host “UPN’s Changed”  
      
    or in a more simplified way, with "Email" column name and "DisplayName" column:  
      
    Import-Csv 1.csv | Foreach {Get-User -Identity $_.email | Set-User -DisplayName $_.DisplayName}  
    

    Best regards,

    0 comments No comments