Skip to content

Instantly share code, notes, and snippets.

@nonprofittechy
Last active August 29, 2015 14:02
Show Gist options
  • Save nonprofittechy/1f8123f79166241575fa to your computer and use it in GitHub Desktop.
Save nonprofittechy/1f8123f79166241575fa to your computer and use it in GitHub Desktop.
Bulk-Import photos into AD
$ipath = "C:\PATH_TO_THUMBNAILS"
$images = gci -Path $ipath
$jpgBytes = $null
foreach ($image in $images) {
$jpgBytes = $null
$jpgBytes = [byte[]]$jpg = Get-Content ($image.fullName) -encoding byte
set-aduser -id $image.BaseName -replace @{thumbnailPhoto = $jpgBytes}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment