0 votes

Is it possible to have Adaxes bulk import the user pictures? We already have the pictures in a directory named with the user's employeeid. Was hoping to import them using that to match.

Thanks again for your help

by (1.2k points)
0

Hello,

This is possible with a PowerShell script. You can use the script with Business Rules, Custom Commands or Scheduled Tasks with the help of a Run a program or PowerShell script action. We've already assigned our scripting guy the task to write the script for you and will update you as soon as he's ready.

1 Answer

0 votes
by (216k points)

Hello,

Here's the script that should do the job:

$userDirectoryPath = "\\server\share\UsersInfo" # TODO: modify me
$pictureFileName = "%username%.jpg" # TODO: modify me

# Get EmployeeId
try
{
    $employeeId = $Context.TargetObject.Get("employeeID")
}
catch
{
    return
}

# Build user folder path
$userDirectoryPath = "$userDirectoryPath\$employeeId"
# Test user folder path
if(!(Test-Path -Path $userDirectoryPath))
{
    $Context.LogMessage("Folder $userDirectoryPath was not found.", "Error") # TODO: modify me
    return
}

# Build user picture path
$picturePath = "$userDirectoryPath\$pictureFileName"
if(!(Test-Path -Path $picturePath))
{
    $Context.LogMessage("The path to the user's picture is incorect.", "Error") # TODO: modify me
    return
}

# Save picture to AD
[Byte[]]$pictureInByte = Get-Content $picturePath -Encoding Byte
$Context.TargetObject.Put("thumbnailPhoto", $pictureInByte)
$Context.TargetObject.SetInfo()

In the script, $userDirectoryPath specifies the path to the folder where subfolders with user pictures are located, and $pictureFileName specifies the template for generating the picture filename for each user. Modify the script to your requirements.

You can use the script in Business Rules, Custom Commands and Scheduled Tasks with the Run a program or PowerShell script action.

Related questions

0 votes
1 answer

I need to use the bulk import to import ~60 users. I am trying to do 1 test account first to ensure everything works, ... adm-CustomAttributeDate1, physicalDeliveryOffice, company, department, manager, title, adm-CustomAttributeText5, ChangePasswordAtLogon

asked Apr 9, 2018 by ScottGriff (400 points)
0 votes
1 answer

Is there a way for Adaxes to use a user's Microsoft 365 profile pictures instead of having to select a file on a per user basis?

asked Feb 1 by keneth.figueroa (20 points)
0 votes
1 answer

Really liking this product. Close to pulling the trigger on it. Just a couple questions concerning the Self Service section. The Personal Title field. A normal user can edit it ... page was unable to display it. More of a feature request I suppose. Thank you,

asked Apr 27, 2011 by Rojs (90 points)
0 votes
1 answer

I've tried using the business container creation script and looping a foreach and I've been getting errors on the SetInfo part, just wondering what I'm doing wrong.

asked May 29 by ajmilic (100 points)
0 votes
1 answer

I need to create a lot of groups that have similar dynamic membership rules. e.g. Marketing group that adds users if they are enabled and if customAttribute10 is "14" Sales ... other settings and attributes between them. So is there a way to do this in bulk?

asked Jan 25, 2023 by jcrook (100 points)
3,548 questions
3,239 answers
8,232 comments
547,814 users