• 512-991-7197
  • This email address is being protected from spambots. You need JavaScript enabled to view it.
  • Always Open

Welcome to Active Directory Tips & Tricks

Set an image for user in AD

Set an image for user in AD

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

Q. How can I easily set the image for an AD user?

A. The below PowerShell will easily set the users picture and also a thumbnail picture (if you have Exchange scheme extensions). Note in my example the image is 283x283 and the thumbnail is 96x96.


$photoFile = "E:\tempfiles\sav283283.jpg"
$thumbFile = "E:\tempfiles\sav9696.jpg"
$username = "johnsav"
$user = Get-ADUser -LDAPFilter "(sAMAccountName=$username)"
$photo = [byte[]](Get-Content $photoFile -Encoding byte)
$thumbPhoto = [byte[]](Get-Content "$thumbFile" -Encoding byte)
Set-ADUser $user -Replace @{jpegPhoto=$photo}
Set-ADUser $user -Replace @{thumbnailPhoto=$thumbPhoto}


Recommend other relevant articles:



© 2019 Austin Laptop [AustinLaptop.Com]. All Rights Reserved.