Force Upload Picture Profile via Office365 Admin

บทความนี้คิดว่าเป็นประโยชน์หากทาง Admin มีความประสงค์ Force Upload picture profile.
สิ่งที่ต้องใช้มีดังนี้
1. ข้อมูล อีเมล์ ที่ต้องการ เปลี่ยน
2. รูปภาพที่ต้องการให้เปลี่ยน
3. csv file
4. PowerShell
5. Account Global admin

#ConnectExchangeOnline
Connect-ExchangeOnline

#ForceSetProfilePicture
Set-UserPhoto -Identity "pilot1" -PictureData ([System.IO.File]::ReadAllBytes("C:\doctor.png")) -Preview
Set-UserPhoto "pilot1" -Save


#ForceSetMultiProfilePicture
#Import-CSV
$Profile = Import-CSV c:\ProfilePicture.csv

#LoopImport
$Profile | ForEach-Object{
#Set-UserPhoto -Identity $_.EmailAddress -PictureData $_.PictureData -Save
Set-UserPhoto -Identity $_.EmailAddress -PictureData ([System.IO.File]::ReadAllBytes($_.PictureData)) -Preview
Set-UserPhoto -Identity $_.EmailAddress -Save
Write-host -f Green "Add Picture Profile  $_.EmailAddress to Add Complete"
}


#Ref: https://docs.microsoft.com/en-us/powershell/module/exchange/set-userphoto?view=exchange-ps

Comment

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.