Guest User

Untitled

a guest
Jun 19th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. # I used the following command to generate my images:
  2. # mogrify -resize 96x96 -gravity center -extent 96x96 -format jpg \
  3. # -path outlook -background black -strip -coalesce -quality 95 *.jpg
  4.  
  5. # Add the Quest AD and Exchange snap-ins
  6. Add-PSSnapin Quest.ActiveRoles.ADManagement -ErrorAction SilentlyContinue
  7. Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin -ErrorAction SilentlyContinue
  8.  
  9. Get-Mailbox -ResultSize Unlimited -RecipientTypeDetails UserMailbox | ForEach {
  10. $username = $_.SamAccountName
  11.  
  12. If (Test-Path C:\Pictures\$username.jpg) {
  13. Write-Host "Photo found for $username, uploading... " -NoNewLine
  14.  
  15. $photo = [byte[]](Get-Content C:\Pictures\$username.jpg -Encoding byte)
  16.  
  17. # Use the Quest AD addons since we don't have 2008 R2 DCs...
  18. #Set-ADUser $username -Replace @{thumbnailPhoto=$photo}
  19. Set-QADUser $username -ObjectAttributes @{thumbnailPhoto=$photo} | Out-Null
  20.  
  21. Write-Host "[OK]" -ForeGroundColor Green
  22. }
  23. }
  24.  
  25. Write-Host "Done."
  26.  
  27. Update-OfflineAddressBook "Default Offline Address Book"
Add Comment
Please, Sign In to add comment