Office 365 bulk update user photos

  1. 首先使用管理員執行powershell, 然後執行:
Install-Module -Name ExchangeOnlineManagement

Connect-ExchangeOnline -Credential $M365credentials

2. 上面第一行安裝模組,這次用exchangeonline 模組

然後將用戶名,及照片路徑放在user.csv 檔案,如

username,picture

2022@rock.net,c:\2022.jpg

3.接著執行:

Import-csv c:\Pics\user.csv | % { Set-UserPhoto –Identity $_.username -PictureData ([System.IO.File]::ReadAllBytes($_.picture)) -Confirm:$false}