Share via

PowerShell - User photo upload

Anonymous
2024-07-09T12:09:05+00:00

I constantly get this error on PowerShell when trying to upload photo for users -

Write-ErrorMessage : A server side error has occurred because of which the operation could not be completed. Please

try again after some time. If the problem still persists, please reach out to MS support.

At C:\Users\adminfo\AppData\Local\Temp\tmpEXO_evcle4qo.x4j\tmpEXO_evcle4qo.x4j.psm1:1204 char:13

  •         Write-ErrorMessage $ErrorObject 
    
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    
    • CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
    • FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Write-ErrorMessage

***moved from Windows / Windows 11 / Accounts, profiles, and login***

Windows for business | Windows Server | User experience | PowerShell

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

5 answers

Sort by: Most helpful
  1. Anonymous
    2024-08-19T05:27:54+00:00

    I've ran into the exact same issue. After 2 days of troubleshooting, i found the issue - cmdlet set-userphoto has been deprecated:

    https://techcommunity.microsoft.com/t5/exchange-team-blog/deprecation-of-exchange-online-powershell-userphoto-cmdlets/ba-p/3955744

    I'm currently working on using Graph PowerShell now

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2024-07-11T17:13:36+00:00

    Hi,

    How did you upload the photo? Can you post the full script?

    According to the error message, this is more of a server-side error than a Windows PowerShell issue. Open the Settings app and navigate to System > Storage > Temporary files to clean the temporary files, then try again to see if the issue persists.

    $Name = [Microsoft.VisualBasic.Interaction]::Inputbox("Enter UPN:")

    $Location = [Microsoft.VisualBasic.Interaction]::Inputbox("Select Picture:")

    Set-UserPhoto -Identity $Name -PictureData ([System.IO.File]::ReadAllBytes($Location)) -confirm:$false

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2024-07-11T07:59:41+00:00

    Set-UserPhoto -Identity "John Smith" -PictureData ([System.IO.File]::ReadAllBytes("C:\Users\Administrator\Desktop\JohnSmith.jpg"))

    I've cleared the files, the error also comes up on a different machine.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2024-07-11T02:19:13+00:00

    Hi,

    How did you upload the photo? Can you post the full script?

    According to the error message, this is more of a server-side error than a Windows PowerShell issue. Open the Settings app and navigate to System > Storage > Temporary files to clean the temporary files, then try again to see if the issue persists.

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2024-07-11T00:18:41+00:00

    having the same issue

    Was this answer helpful?

    0 comments No comments