Exporting AD photo via PowerShell

Another one that I always seem to have to look up. Putting it here for quick reference.


$User=GET-ADUser -identity –properties thumbnailphoto, SamAccountName

$Filename='C:\scripts\' + $User.SamAccountName + '_ADExport.jpg'

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

Leave a Reply

Your email address will not be published. Required fields are marked *