Others

Bulk Update Microsoft 365 User Display Names with PowerShell

Emma BrownEmma Brown Nov 13, 2026 869 views

Question details

Update display names for many Microsoft 365 users using usernames and new names from a CSV file.

Bulk Update Microsoft 365 User Display Names with PowerShell
Product
Microsoft 365 and Microsoft Graph PowerShell
Device & OS
not provided
Scenario
An administrator needs to apply display name changes to thousands of Microsoft 365 accounts.
Observed behavior
The desired result is for each CSV entry to update the matching user's Microsoft 365 display name.
Before you start

Prepare a CSV with UserPrincipalName and DisplayName headers, and confirm that each user principal name identifies the intended account. Use an account with an appropriate Microsoft Entra administrator role and permission to update users; some privileged accounts require additional permissions.

Solution 1Recommended

Update display names with Microsoft Graph PowerShell

Use a CSV file and Microsoft Graph PowerShell to update user accounts in batches.

Microsoft Graph PowerShell replaces the retired MSOnline module, so use Update-MgUser rather than the older Set-MsolUser command.

1
Prepare the CSV

In a spreadsheet editor or text editor, create a UTF-8 CSV named users.csv with the headers UserPrincipalName,DisplayName. Add one account per row, for example: alex@example.com,Alex Morgan.

2
Install the user module

Open PowerShell and run: Install-Module Microsoft.Graph.Users -Scope CurrentUser. Accept any installation prompts, then run Import-Module Microsoft.Graph.Users.

3
Connect to Microsoft Graph

Run Connect-MgGraph -Scopes "User.ReadWrite.All" and sign in with an appropriately authorized administrator account. Grant administrator consent if prompted and authorized to do so.

4
Test a small batch

Create a test CSV containing only a few accounts, then run: Import-Csv ./test-users.csv | ForEach-Object { Update-MgUser -UserId $_.UserPrincipalName -DisplayName $_.DisplayName -ErrorAction Stop }. Correct any errors before continuing.

5
Update the full list

After the test succeeds, run: Import-Csv ./users.csv | ForEach-Object { Update-MgUser -UserId $_.UserPrincipalName -DisplayName $_.DisplayName -ErrorAction Stop }. Use the actual path to your CSV if it is not in the current PowerShell folder.

6
Verify the changes

In the Microsoft 365 admin center, open Users > Active users and search for updated accounts. You can also run Get-MgUser -UserId "alex@example.com" -Property UserPrincipalName,DisplayName | Select-Object UserPrincipalName,DisplayName in PowerShell.

Update display names with Microsoft Graph PowerShell
Check for partial updates: If the command stops on an error, earlier rows may already have been updated. Review the error and verify the affected accounts before rerunning the remaining rows.
Free Microsoft Office alternative

Prepare Your User List with WPS Spreadsheet

WPS Office is a free, lightweight Office alternative with a familiar interface for editing user lists. Open your existing spreadsheet or CSV, prepare the display names, and save a CSV for the Microsoft Graph PowerShell update. WPS does not update Microsoft 365 accounts itself.

Organize user principal names and display names in a spreadsheetOpen and edit Microsoft Excel XLSX and XLS filesWork with CSV files for PowerShell importsUse a familiar interface for an easier move from Microsoft Office
microsoft office alternative - wps office

Frequently Asked Questions

What columns does the CSV need?

Use UserPrincipalName and DisplayName as the header names. Each row should contain the target account's user principal name and its new display name.

Can I use Set-MsolUser for this update?

Set-MsolUser belongs to the retired MSOnline module. Use the Microsoft Graph PowerShell command Update-MgUser for the current approach.

Why does the update fail for some accounts?

Check the user principal name, the signed-in administrator's role, and consent for the User.ReadWrite.All permission. Updating privileged accounts can require additional permissions.

How can I confirm a display name changed?

Search for the user under Users > Active users in the Microsoft 365 admin center, or run Get-MgUser with the user's principal name and request the DisplayName property.

Can WPS Office make the Microsoft 365 changes?

WPS Spreadsheet can help prepare the CSV, but the account updates must be made through Microsoft Graph PowerShell or another authorized Microsoft 365 administration tool.