This script find and export Office 365 Users without profile picture to CSV file. We can extract this report using Exchange Online powershell cmdlets Get-Mailbox and Get-Userphoto.

Before proceed run the following command to connect Exchange Online powershell module. 

PowerShell
Edit|Remove
$365Logon = Get-Credential 
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $365Logon -Authentication Basic -AllowRedirection 
Import-PSSession $Session
This Script can accepts a parameter from PS command console

# OutputFile (Optional) - File path to save the Output CSV file.

Use the below command to run the script file
PowerShell
Edit|Remove
 .\Export-o365Users-without-photo.ps1  -OutputFile "C:\Reports\office-365-users-without-photo.csv"
 Note: If you don't pass an output file path, it will save the output file in your PS working directory (".\office-365-users-without-photo.csv").