Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # I used the following command to generate my images:
- # mogrify -resize 96x96 -gravity center -extent 96x96 -format jpg \
- # -path outlook -background black -strip -coalesce -quality 95 *.jpg
- # Add the Quest AD and Exchange snap-ins
- Add-PSSnapin Quest.ActiveRoles.ADManagement -ErrorAction SilentlyContinue
- Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin -ErrorAction SilentlyContinue
- Get-Mailbox -ResultSize Unlimited -RecipientTypeDetails UserMailbox | ForEach {
- $username = $_.SamAccountName
- If (Test-Path C:\Pictures\$username.jpg) {
- Write-Host "Photo found for $username, uploading... " -NoNewLine
- $photo = [byte[]](Get-Content C:\Pictures\$username.jpg -Encoding byte)
- # Use the Quest AD addons since we don't have 2008 R2 DCs...
- #Set-ADUser $username -Replace @{thumbnailPhoto=$photo}
- Set-QADUser $username -ObjectAttributes @{thumbnailPhoto=$photo} | Out-Null
- Write-Host "[OK]" -ForeGroundColor Green
- }
- }
- Write-Host "Done."
- Update-OfflineAddressBook "Default Offline Address Book"
Add Comment
Please, Sign In to add comment