Others

How to Change a User UPN in Active Directory with PowerShell

Algirdas JasaitisAlgirdas Jasaitis Nov 3, 2026 869 views

Question details

The user needs to change User Principal Names (UPN) for one or multiple users in Active Directory without altering the UPN suffix or SAM account name.

How to Change a User UPN in Active Directory with PowerShell
Product
Active Directory / PowerShell
Device & OS
not provided
Scenario
Administrating user accounts and updating UPNs either individually or in bulk via PowerShell cmdlets.
Observed behavior
The goal is to successfully execute the Set-ADUser cmdlet to update user principal names efficiently.
Before you start

Ensure you have the Active Directory PowerShell module installed and that you are running your PowerShell session with Domain Administrator privileges.

Solution 1Recommended

Change a Single User's UPN via PowerShell

Use this direct cmdlet method to quickly update the User Principal Name for an individual Active Directory account.

The Set-ADUser cmdlet is the most straightforward way to modify user properties in Active Directory. It allows you to target a specific user and update their UPN without affecting their SAM account name or other attributes.

1
Open PowerShell as Administrator

Right-click the Start menu or Windows icon and select 'Windows PowerShell (Admin)' to launch a session with elevated privileges.

2
Execute the Set-ADUser Cmdlet

Type the command: Set-ADUser -Identity "username" -UserPrincipalName "newuser@example.com" and press Enter. Replace "username" with the target user's identity.

3
Verify the Change

Confirm the update was successful by running: Get-ADUser -Identity "username" -Properties UserPrincipalName.

Change a Single User's UPN via PowerShell
Operation Complete: The UPN changes take effect immediately in the local domain controller, though it may take a few moments to replicate across the network.
Free Microsoft Office alternative

Manage Your IT Export Files Easily with WPS Office

While PowerShell handles your Active Directory tasks, you often need a reliable spreadsheet tool to edit CSV files for bulk UPN updates. WPS Office is a lightweight, completely free alternative to Microsoft Office that opens CSVs instantly and makes editing administrative scripts and exports a breeze.

Perfectly compatible with Microsoft Excel formats (.xlsx, .csv) for seamless IT script data management.Lightweight and incredibly fast, capable of opening massive user export logs instantly without lagging.Familiar, tabbed user interface that requires zero learning curve for professionals transitioning from Microsoft Office.
microsoft office alternative - wps office

Frequently Asked Questions

Can I change the UPN suffix for all users in a specific Organizational Unit (OU)?

Yes. You can use the Get-ADUser cmdlet along with the -SearchBase parameter to target a specific OU. You can then pipe the results into a ForEach-Object loop to update the UPN suffix for all users within that unit using Set-ADUser.

Does changing the UPN affect the user's SAM account name?

No, the User Principal Name (UPN) and SAM account name are distinct attributes in Active Directory. Changing the UPN with the Set-ADUser cmdlet does not alter the SAM account name traditionally used for legacy network logons.

Why am I getting an 'Access Denied' error when running Set-ADUser?

This error typically occurs if you do not have sufficient permissions to modify Active Directory objects. Ensure that you are running PowerShell as an Administrator and that your logged-in account holds Domain Admin or Account Operator privileges.