SOLVED

set-userphoto

%3CLINGO-SUB%20id%3D%22lingo-sub-313128%22%20slang%3D%22en-US%22%3Eset-userphoto%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-313128%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Experts%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20want%20to%20upload%20profile%20picture%20of%20one%20user%2C%20i%20am%20getting%20error.%20i%20dont%20remember%20the%20error%20now%3C%2FP%3E%3CP%3Ei%20have%20used%20the%20below%20syntax%20i%20am%20getting%20error.%3CBR%20%2F%3EIs%20there%20restriction%20on%20photo%20dimensions%20or%20size%3F%3C%2FP%3E%3CP%3E%3CBR%20%2F%3ESet-UserPhoto%20%22username%22%20-PictureData%20(%5BSystem.IO.File%5D%3A%3AReadAllBytes(%22C%3A%5CUsers%5CAdministrator%5CDesktop%5Cphoto.jpg%22))%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOne%20of%20my%20other%20user%20wants%20to%20upload%20new%20picture%20replacing%20the%20existing%20one.%3CBR%20%2F%3Ewill%20the%20below%20syntax%20work.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3ESet-UserPhoto%20%22username%22%20-PictureData%20(%5BSystem.IO.File%5D%3A%3AReadAllBytes(%22C%3A%5CUsers%5CAdministrator%5CDesktop%5Cphoto.jpg%22))%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-313128%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAdmin%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExchange%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EHybrid%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOn-Premises%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-313266%22%20slang%3D%22en-US%22%3ERe%3A%20set-userphoto%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-313266%22%20slang%3D%22en-US%22%3E%3CP%3EYes%2C%20there%20are%20limits%2C%20most%20prominent%20one%20being%20the%2010KB%20size%20when%20running%20it%20against%20other%20users.%20Follow%20the%20method%20detailed%20here%20as%20a%20workaround%3A%20%3CA%20href%3D%22https%3A%2F%2Fsupport.microsoft.com%2Fml-in%2Fhelp%2F3062745%2Fuser-photos-aren-t-synced-from-the-on-premises-environment-to-exchange%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsupport.microsoft.com%2Fml-in%2Fhelp%2F3062745%2Fuser-photos-aren-t-synced-from-the-on-premises-environment-to-exchange%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Frequent Contributor

Hi Experts

 

I want to upload profile picture of one user, i am getting error. i dont remember the error now

i have used the below syntax i am getting error.
Is there restriction on photo dimensions or size?


Set-UserPhoto "username" -PictureData ([System.IO.File]::ReadAllBytes("C:\Users\Administrator\Desktop\photo.jpg"))

 

One of my other user wants to upload new picture replacing the existing one.
will the below syntax work.


Set-UserPhoto "username" -PictureData ([System.IO.File]::ReadAllBytes("C:\Users\Administrator\Desktop\photo.jpg"))

 

1 Reply
Highlighted
Best Response confirmed by Rising Flight (Frequent Contributor)
Solution

Yes, there are limits, most prominent one being the 10KB size when running it against other users. Follow the method detailed here as a workaround: https://support.microsoft.com/ml-in/help/3062745/user-photos-aren-t-synced-from-the-on-premises-envi...