Skip to main content

Add Profile Picture to Active Directory

Add Profile Picture to Active Directory

The first line in the below example stores a hexadecimal-encoded copy of an image named knight.jpg in a variable named $photo. The second line sets the thumbnailPhoto attribute for the specified Active Directory user object using the $photo variable. The -replace option is used to replace any existing value.

$photo = [byte[]](Get-Content D:\Downloads\knight.jpg -encoding byte)
set-aduser newb -replace @{thumbnailphoto=$photo}

Uploaded photos should be 100KB or smaller