For exporting users thumbnail photo from AD to jpg for all users you can use script below:
Get-ADUser -Filter * -Properties thumbnailphoto | where {$_.thumbnailphoto} | foreach {$_.thumbnailphoto | Set-Content -Path "C:$($_.UserPrincipalName).jpg" -Encoding Byte}
~Pouyan