I\'m trying to export a list of all users with no photo from our Exchange Online account using powershell. I cannot get it to work and have tried various methods.
G
You can throw your own error like so:
try { $error.Clear() $user | Get-UserPhoto if ($error[0].CategoryInfo.Reason -eq "UserPhotoNotFoundException") {throw "UserPhotoNotFoundException" } } catch { #code }