Exchange 2013 – Remove User Photos

I had a requirement to quickly remove all users photos from a clients Exchange estate. I know the same can be done using CodeTwo Apps but without some considerable effort this was an easier way if you have or can get hold of the SamAccountNames.

Here is how I completed this task.

This script is nice a easy, it uses the ForEach command and imports a CSV of users by it’s SamAccountName.

$csv = Import-Csv C:\Scripts\User-Accounts.csv
ForEach ($line in $csv) {
Remove-UserPhoto $line.SamAccountName -confirm:$false
}

Place the above code into a text file with the extension of *.ps1 note this line $csv = Import-Csv C:\Scripts\User-Accounts.csv change to point to the location you have saved your user accounts csv in the below format.

SamAccountName
WChurchill
MBen
GWashington
MBean

Execute the *.ps1 in the normal way and within a few moments the photos will be removed from Exchange.

Download “Exchange-RemovePhotos.ps1” Exchange-RemovePhotos.ps1 – Downloaded 394 times – 594 B

Be the first to comment on "Exchange 2013 – Remove User Photos"

Leave a comment

Your email address will not be published.


*