In this post I am going to tell you how you can find a list of users without profile picture in office 365 by using PowerShell script.
First you have to run following command to connect exchange inline PowerShell module:
$365Logon = Get-Credential $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $365Logon -Authentication Basic -AllowRedirection Import-PSSession $Session
Export office 365 users without profile picture to CSV file
Run following PowerShell script to get a list of users who don’t have profile picture on office 365 and export them into csv file
$Result=@() $allUsers = Get-Mailbox -RecipientTypeDetails UserMailbox -ResultSize Unlimited $totalusers = $allUsers.Count $i = 1 $allUsers | ForEach-Object { $user = $_ Write-Progress -activity "Processing $user" -status "$i out of $totalusers completed" $photoObj = Get-Userphoto -identity $user.UserPrincipalName -ErrorAction SilentlyContinue If($photoObj.PictureData -eq $null) { $Result += New-Object PSObject -property @{ UserName = $user.DisplayName UserPrincipalName = $user.UserPrincipalName }} $i++ } $Result | Export-CSV "C:\\office-365-users-without-photo.csv" -NoTypeInformation -Encoding UTF8
Export all office 365 users with profile picture status
$Result=@() $allUsers = Get-Mailbox -RecipientTypeDetails UserMailbox -ResultSize Unlimited $totalusers = $allUsers.Count $i = 1 $allUsers | ForEach-Object { $user = $_ Write-Progress -activity "Processing $user" -status "$i out of $totalusers completed" $photoObj = Get-Userphoto -identity $user.UserPrincipalName -ErrorAction SilentlyContinue $hasPhoto = $false if ($photoObj.PictureData -ne $null) { $hasPhoto = $true } $Result += New-Object PSObject -property @{ UserName = $user.DisplayName UserPrincipalName = $user.UserPrincipalName HasProfilePicture = $hasPhoto } $i++ } $Result | Export-CSV "C:\\office-365-users-photo-status.csv" -NoTypeInformation -Encoding UTF8
Profile picture status for specific user
$photoObj = Get-Userphoto -Identity "alexw@contoso.com" -ErrorAction SilentlyContinue If($photoObj.PictureData -ne $null) { Write-Host "User has profile picture" } Else { Write-Host "Profile picture not configured" }