Skip to content

update-mguser encoding issues with displayname #3158

@halukpn

Description

@halukpn

Describe the bug

I am trying to use the command:
Update-MgUser -UserID $id -DisplayName ""
To set display name for users. The displayname text is not encoded correctly.
For example:
Update-MgUser -UserID $id -DisplayName "11 & 22"
Display name ends up as: 11 u0026 22
And so on for other characters.
Also:
Update-MgUser -UserID $id -DisplayName "Ernst"
ends up as: Est (for some reason rn next to each other are always removed from a string)

I've tried escaping, quotes etc and nothing helps.

PowerShell 7.5 on Windows, in vscode or Windows terminal, same issue.

Expected behavior

Should be able to handle normal characters.

How to reproduce

Update-MgUser -UserID $id -DisplayName "11 & 22"
Update-MgUser -UserID $id -DisplayName "Ernst

SDK Version

2.26.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions