AD

Get AD users without photo

 

get-ADUser -Filter * -properties thumbnailPhoto | ? {!$_.thumbnailPhoto} |? {$_.enabled}| select Name|Out-GridView

The !$_.thumbnailPhoto means without photo and $_.enabled is for account that are enabled only.

Advertisements

[PowerShell] Export AD photo

Here is a PowerShell to export AD photo, please make sure you have the rights to do so before running the script. The script will prompt for the username and it will be saved as “username.jpg” under the path specify in $path variable.

 

$username = Read-Host 'Please enter Username'

$path = 'C:\Photos\'

$User=GET-ADUser $username –properties thumbnailphoto

$Filename=$path+$username+'.jpg'

[System.Io.File]::WriteAllBytes($Filename, $User.Thumbnailphoto)