Remove Microsoft 365 User Photos in Bulk with PowerShell
Question details
Remove profile photos from all licensed Microsoft 365 member users without individual confirmation prompts.

- Product
- Microsoft 365 and Microsoft Graph PowerShell
- Device & OS
- not provided
- Scenario
- An administrator wants to remove profile photos in bulk while excluding guests and unlicensed users.
- Observed behavior
- Running Remove-UserPhoto without supplying an identity prompts for a user identity.
Use an administrator account with permission to manage users' profile photos, and obtain admin consent for the required Microsoft Graph permissions. Review the target list and test the deletion on one intended account before running it for everyone.
Remove licensed member photos with Microsoft Graph PowerShell
Use this method to identify licensed member users and delete each profile photo without confirmation prompts.
Microsoft Graph is the current approach for managing Microsoft 365 profile photos. Supplying each user's ID in the request avoids the identity prompt.
The deletion is a live change. Users without a photo or accounts that cannot be updated may produce errors, which the script reports while continuing.
In PowerShell, run: Install-Module Microsoft.Graph -Scope CurrentUser. Then connect with: Connect-MgGraph -Scopes 'User.Read.All','ProfilePhoto.ReadWrite.All'. Grant admin consent when required.
Run: $Users = Get-MgUser -All -Property Id,UserPrincipalName,UserType,AssignedLicenses | Where-Object { $_.UserType -eq 'Member' -and $_.AssignedLicenses.Count -gt 0 }. Review it with: $Users | Select-Object UserPrincipalName.
Choose an intended test account from the reviewed list, then run: $test = $Users | Where-Object { $_.UserPrincipalName -eq 'user@example.com' }; $uri = 'https://graph.microsoft.com/v1.0/users/{0}/photo/$value' -f $test.Id; Invoke-MgGraphRequest -Method DELETE -Uri $uri. Replace the example address and verify that the photo is removed before continuing.
After verifying the test, run: foreach ($user in $Users) { $uri = 'https://graph.microsoft.com/v1.0/users/{0}/photo/$value' -f $user.Id; try { Invoke-MgGraphRequest -Method DELETE -Uri $uri -ErrorAction Stop; Write-Host "Removed photo: $($user.UserPrincipalName)" } catch { Write-Warning "Could not remove photo for $($user.UserPrincipalName): $_" } }. The requests do not prompt for confirmation.

Work with Office files in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for opening and editing Office files, making it easy to move everyday document work. Microsoft 365 profile-photo administration still requires Microsoft tools.

Frequently Asked Questions
Why does Remove-UserPhoto ask for an identity?
The command needs an identity for each user. For Microsoft 365, use the Microsoft Graph approach above and include each user's ID in the photo deletion request.
How can I exclude guest and unlicensed accounts?
Filter the results of Get-MgUser using UserType equal to 'Member' and AssignedLicenses.Count greater than zero. Review the resulting UserPrincipalName list before deleting photos.
What permissions do I need to remove other users' photos?
Connect with User.Read.All and ProfilePhoto.ReadWrite.All, obtain admin consent as required, and use an account with an appropriate Microsoft Entra role for managing profile photos.
Will a failed deletion stop the entire script?
The bulk example uses try and catch to report an error and continue to the next user. Review the warnings afterward to identify accounts that need attention.




