Get-MgUserPhotoContent does not return what was set using Set-MgUserPhotoContent

Müller Martin 5 Reputation points

Describe the bug

When using Set-MgUserPhotoContent and then Get-MgUserPhotoContent, the returned value is not the same as was set using Set-MgUserPhotoContent. I assume the image is compressed.

To Reproduce
Set-MgUserPhotoContent -infile C:\Temp\photoIn.jpg
Get-MgUserPhotoContent -outfile C:\Temp\photoOut.jpg

Expected behavior
I would expect the two files to be identical

Debug Output
not applicable

Module Version

Environment Data
Name Value

PSVersion 5.1.19041.3570
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.3570
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3

Additional context
This is important for tools syncing photos. MIM for example. MIM performs a "confirming import" to check if the correct value was set in the target system.

Microsoft Exchange Online
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,057 questions
Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,306 questions
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,219 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Miguel Gonçalves | AVANADE 546 Reputation points

    Hi Muller,

    When using the Set-MgUserPhotoContent and Get-MgUserPhotoContent cmdlets, it’s indeed expected that the two files may not be identical due to various factors, including image compression.

    0 comments No comments