We use cookies to improve your experience.
By your continued use of this site you accept such use.
For more details please see our privacy policy and cookies policy.

Script repository

Export user photo to file

February 25, 2021 Views: 2728

The script exports a user's photo stored in the Picture (thumbnailPhoto) attribute to a file.

To export photos using Adaxes, you can create a custom command that runs the script. For more information, see Create a Custom Command.

Parameters:

  • $filePath - specifies a template for the file path that will contain the user's photo. You can use value references (e.g. %username%) to insert properties of the user account as a part of the path.

Edit Remove
PowerShell
$filePath = "\\Server\share\UserPictures\%username%.jpg" # TODO: modify me
try
{
    $thumbnailPhoto = $Context.TargetObject.Get("thumbnailPhoto")
}
catch
{
    return # The Picture property is empty
}
try
{
    Set-Content -Path $filePath -Encoding byte -Value $thumbnailPhoto -ErrorAction Stop
}
catch
{
    $Context.LogMessage($_.Exception.Message, "Error")
} 
Comments 2
avatar
Daniel Sadler Jun 07, 2022
Does this pull the info/photo from Office 365?
avatar
Support Jun 07, 2022
Hello Daniel,

No, the script gets the photo from the Picture (LDAP name thumbnailPhoto) property of an on-premises AD account.
Leave a comment
Loading...

Got questions?

Support Questions & Answers