Others

Remove Microsoft 365 User Photos in Bulk with PowerShell

Kushani NimanthikaKushani Nimanthika Nov 14, 2026 868 views

Question details

Remove profile photos from all licensed Microsoft 365 member users without individual confirmation prompts.

Remove Microsoft 365 User Photos in Bulk with PowerShell
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.
Before you start

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.

Solution 1Recommended

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.

1
Install and connect to Microsoft Graph

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.

2
Build and review the target list

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.

3
Test one account

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.

4
Remove photos for the full list

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.

Remove licensed member photos with Microsoft Graph PowerShell
Review reported errors: The test account may report an error in the full run because its photo was already removed. Check other errors for missing photos, permissions, or service issues.
Free Microsoft Office alternative

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.

Review user lists and administrative reports in spreadsheetsCompatible with Microsoft Office formats including XLSX, DOCX, and PPTXFamiliar editing interface for an easier transitionFree and lightweight for everyday office work
microsoft office alternative - wps office

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.