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.


Get AD group with owner


Get-ADGroup -Filter * -Properties managedby|select name,distinguishedname,objectclass,groupscope,managedby|where {-not $_.managedby}|Out-GridView

[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


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