Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Microsoft Office 365–Using Exchange PowerShell to get Users photo from Microsoft Office 365

You can use the Get-UserPhoto cmdlet to view information about the user photos feature that allows users to associate a picture with their account. User photos appear in on-premises and cloud-based client applications, such as Microsoft Outlook Web App (OWA), Lync, Skype for Business, and SharePoint.

Please note that,


- The user photos feature allows users to associate a picture with their account.
- User photos are stored in the user's Active Directory account and in the root directory of the user's Exchange mailbox.
- The user photo feature must be set for a user before you can run the Get-UserPhoto cmdlet to view information about the user's photo. Otherwise, you get an error message saying the user photo doesn't exist for the specified users.
- Administrators use the Set-UserPhoto cmdlet or the Exchange admin center (EAC) to configure user photos. Alternately the users can upload, preview, and save a user photo to their account by using the Outlook on the web Options page.

So let we play with this cmdlet:

PS C:WINDOWSsystem32> Get-UserPhoto "[email protected]"

RunspaceId  : 7adbbe2f-e5eb-4156-b8ed-2b0d5e9140fb
Identity    : deva
PictureData : {255, 216, 255, 224...}
Thumbprint  : -2069673794
IsValid     : True
ObjectState : New

It gets you the User photo info.

Let me tweak it a bit – as the requirement is to get all the user photo from Office 365.

PS C:WINDOWSsystem32> get-mailbox | % {Get-UserPhoto $_.identity} | % {Set-Content -path "d:export$($_.identity).jpg
" -value $_.picturedata -Encoding byte}

Once the above powershell works, then let me look at the path that we set it above. The folder path will contain the Users Photo from Office 365 user’s Exchange mailbox/AD.

Hope this helps.

Share the post

Microsoft Office 365–Using Exchange PowerShell to get Users photo from Microsoft Office 365

×

Subscribe to Msdn Blogs | Get The Latest Information, Insights, Announcements, And News From Microsoft Experts And Developers In The Msdn Blogs.

Get updates delivered right to your inbox!

Thank you for your subscription

×