At a customer site recently, I came across some remnants of a Lync trial where users had thumbnail photos attached to their AD accounts. Trouble was, some of them were wrong, some were missing and some needed to be removed. Now there are plenty of tools out there to manage images, but I wanted to create a tool for our service desk to use at zero cost, using powershell.
The attached file will allow you to:
- List all users in an OU with a picture
- List all users in an OU with or without a picture
- Delete all images in an OU
- Upload a generic image to all users in an OU
- Delete an individual Image
- Upload an individual image
- Save all images in an OU to a folder
- batch upload pictures (must be names with the users samaccount name to work)
I can’t take all the credit for this, much was gleaned from Googling and learning how to do various tasks, the code could be better and there isn’t too much in the way of error trapping at the moment. If I get more time, I may develop this further to include features and improve the error handling.
Run the script..
Click Connect.. to connect to your AD..
Use the tree browser to select an OU, then click Get Users to get a list of users. (Users with a picture are shown by the text System.Byte in the thumbnail photo column. Select the user name in the first column and hit show picture to show the pic (I need to change this to happen ‘on click’)
Then use the buttons along the bottom to perform the various tasks.
I strongly recommend you try this on a non-production system first to get a feel for it!
As always, use at your own risk, comments and feedback welcome ..