Hello there,
Following are the requirements before we get started. Make sure you set up your environment with these:
-Azure AD Administrator
-Exchange Online Administrator
-AzureAD PowerShell Module
-Exchange Online PowerShell Module (only if MFA is in use)
First and foremost, we need to fetch the Office365 credentials and then connect to Azure Active Directory and Exchange Online.
$cred = get-Credential
Connect-AzureAD -Credential $cred
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $cred -Authentication Basic -AllowRedirection
Import-PSSession $Session
$Users = Get-AzureADUser | Where {$.UserType -eq 'Member' -and $.AssignedLicenses -ne $null}
$NoPicUsers = @()
foreach ($user in $Users)
{
$Picture = Get-UserPhoto -Identity $user.UserPrincipalName -ErrorAction SilentlyContinue
if ($Picture -eq $null)
{
$NoPicUsers += $user
}
}
------------------------------------------------------------------------------------------------------------------------------------------------
--If the reply is helpful, please Upvote and Accept it as an answer–