Today, I looked at how to retrieve a list of users that don’t have a user profile picture using PowerShell.

Once again I’m using PnP PowerShell. First I connect to my admin site of my tenant:

Connect-PnPOnline https:\ \

Then I collect the properties of my user profile:

$user = Get-PnPUserProfileProperty -Account

$user.PictureUrl now contains the Url to my profile picture.

Ok, this is the first step of the task. Now I need to go through all my users.


Connect-SPOService -Url https:/ /
Get-SPOUser -Site https:/ /


Ok, so now I’ve got all my user login details.

$loginnames = Get-SPOUser -Site https:/ / | select -Property LoginName


Now some plumbing around the code so far and the list of users is returned:

$cred = Get-Credential -Message "Password" -UserName

Connect-PnPOnline https:/ / -Credentials $cred
Connect-SPOService -Url https:/ / -Credential $cred
$loginNames = Get-SPOUser -Site https:/ / | select -Property LoginName
foreach($loginName in $loginNames)

  $user = Get-PnPUserProfileProperty -Account $loginName.LoginName
  if ($user.PictureUrl -eq "" -or $user.PictureUrl -eq $null )
    Write-Host $loginName