Remove user pictures

Vaikaumaverick 1 Reputation point
2020-09-20T16:29:37.337+00:00

Hello awesome community, I have a requirement to remove user pictures from particular country. Then set them to default. This needs to be done periodically. I see that user can set the pictures at multiple locations in office 365 like exchange SharePoint lync etc. How can this be tackled. Any pointers to do this programmatically?

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,175 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,466 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. KyleXu-MSFT 26,211 Reputation points
    2020-09-21T02:38:26.583+00:00

    @Vaikaumaverick
    I would suggest you use command below to check whether could find correct users first:

    Get-User | where{$_.CountryOrRegion -eq "United States"}  
    

    Then, you can use this command below to remove photo from Exchange online mailboxes, it will sync to other Office 365 places:

    Get-User | where{$_.CountryOrRegion -eq "United States"} | Remove-UserPhoto  
    

    To prevent user from modifying photo, you need to add limitation from many places, such as, from Exchange online you need to modify OWA policy to prevent user from modify photo in OWA(You could create a new OWA policy to apply on the mailbox that you want to limit). About other limitation such as Teams, you could have a look about this articles: How to prevent users from changing profile photos in Microsoft 365

    Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.