How to get and update your profile picture in Active Directory (AD)

Updating your Profile Picture in Active Directory is often an annoying process with not enough tools available (or working) to do so. Luckily there are some handy powershell commands that we can use to update this quickly.


First we need to enable the command that we want to use:

  1. Download Remote Server Administration Tools for your OS version (in my case Windows 10 - https://www.microsoft.com/en-us/download/details.aspx?id=45520)
  2. Open an elevated PowerShell (ignore the warning) and run: import-module ActiveDirectory

Interesting commands

Get Full User Details

Get-ADUser -Credential "<your_username>" -Server "<your_server>" -f {GivenName -eq 'Xavier' -and Surname -eq 'Geerinck'} -Properties * | Select *

Note: Instead of specifying the GivenName and Surname through the filter (-f) you can also just add your to achieve the same effect

Save User Photo

Get-ADUser -Credential "<your_username>" -Server "<your_server>" -f {GivenName -eq 'Xavier' -and Surname -eq 'Geerinck'} -Properties *

$userProperties.thumbnailPhoto | Set-Content "C:\ProfilePicture.jpg" -Encoding byte

Update User Photo

Get-ADUser -Credential "<your_username>" -Server "<your_server>" <your_username> -Replace @{thumbnailPhoto=([byte[]](Get-Content "C:\ProfilePicture.jpg" -Encoding byte))}

Xavier Geerinck

Xavier works as a Cloud Solution Architect at Microsoft, helping its customer unlock the full potential of the cloud. Even though he is still considered a young graduate, he achieved his first success at the age 16, by creating and selling his first startup. He then took this knowledge to create and help more startups in different markets such as technology, social media, philanthropy and home care. While in the meantime gaining more enterprise insights at renowned enterprises such as Nokia, Cisco and now Microsoft.

Read More