The Update-MgUser cmdlet in PowerShell updates the properties of a user object in Microsoft Graph.
To use the Update-MgUser cmdlet, you must first connect to your Microsoft 365 tenant using the Connect-MGraph
cmdlet. Once you are connected, you can use the Update-MgUser cmdlet to update user properties.
Connect-MgGraph -Scopes User.ReadWrite.All
In this article, we will discuss how to use the Update-MgUser cmdlet in PowerShell to update the display name of the user, manager.
How to Update a User’s Display Name
To update a user’s display name, use the Update-MgUser cmdlet. This command uses the -UserId
parameter to retrieve the user that you want to update and the -DisplayName
parameter to specify the full name of the user.
Update-MgUser -UserId 'd89e3afc-c554-4607-8748-07b78dc7121a' -DisplayName 'Laura k Rubi'
This command updates the specified user’s display name.
How to Update the Contact Information of the User
To update the contact information of a user such as city and country name, use the Update-MgUser cmdlet with the -City
and -Country
parameter.
Update-MgUser -UserId 'd89e3afc-c554-4607-8748-07b78dc7121a' -City 'Houston' -Country 'United States'
This command updates the city and country name for the user in Microsoft Graph.
How to Update the Department Name of the User
To update the department name of the user in Microsoft Graph, run the following command.
Update-MgUser -UserId 'd89e3afc-c554-4607-8748-07b78dc7121a' -Department 'HR'
This command updates the department name of a user.
How to Update the Job Title of the User
To update the job title of the user in Microsoft Graph, run the following command.
Update-MgUser -UserId 'd89e3afc-c554-4607-8748-07b78dc7121a' -JobTitle 'System Administrator'
This command updates the job title of a user as “System Administrator“.
Conclusion
I hope the above article on how to use the Update-MgUser cmdlet in PowerShell to update the properties of a user object in Microsoft Graph is helpful to you.
You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.