Compartir a través de


Get-UserPhoto cmdlet may throw UserPhotoNotFoundException

Based on my last Get-userphoto blogpost, if you run the Exchange Powershell then you may get the following error:

Error on proxy command 'Get-UserPhoto -Identity:'CN=svcadmin,OU=xxxx.onmicrosoft.com,OU=Microsoft Exchange Hosted
Organizations,DC=xxxx,DC=xxx,DC=outlook,DC=com'' to server xxxx.xxxx.xxx.outlook.com: Server version 15.20.xxxx.0000, Proxy method PSWS:
Cmdlet error with following error message:

Microsoft.Exchange.Data.Storage.UserPhotoNotFoundException: There is no photo stored here.
at Microsoft.Exchange.Configuration.Tasks.Task.ThrowError(Exception exception, ErrorCategory errorCategory, Object
target, String helpUrl)
at Microsoft.Exchange.Configuration.Tasks.Task.WriteError(Exception exception, ErrorCategory category, Object
target, Boolean reThrow)
at Microsoft.Exchange.Management.RecipientTasks.GetUserPhoto.ConvertDataObjectToPresentationObject(IConfigurable
dataObject)
at Microsoft.Exchange.Configuration.Tasks.GetRecipientObjectTask`2.WriteResult(IConfigurable dataObject)
at Microsoft.Exchange.Configuration.Tasks.GetTaskBase`1.WriteResult[T](IEnumerable`1 dataObjects)
at Microsoft.Exchange.Configuration.Tasks.GetObjectWithIdentityTaskBase`2.InternalProcessRecord()
at Microsoft.Exchange.Configuration.Tasks.GetRecipientObjectTask`2.InternalProcessRecord()
at Microsoft.Exchange.Configuration.Tasks.Task.<ProcessRecord>b__92_1()
at Microsoft.Exchange.Configuration.Tasks.Task.InvokeRetryableFunc(String funcName, Action func, Boolean
terminatePipelineIfFailed)..
+ CategoryInfo : NotSpecified: (:) [Get-UserPhoto], CmdletProxyException
+ FullyQualifiedErrorId : [Server=xxxxxx,RequestId=dd9a8b18-1053-4b8f-b4dc-784535f93bba,TimeStamp=28-02-201
8 22:43:53] [FailureCategory=Cmdlet-CmdletProxyException] FC039E2C,Microsoft.Exchange.Management.RecipientTasks.GetUserPhoto
+ PSComputerName : outlook.office365.com

Please note that you will get UserPhotoNotFoundException when you call Get-UserPhoto cmdlet call. It’s an expected behavior - as the given user photo is not set or no photo stored; validate in ECP or Admin Center whether the given user photo is set.

Hope this helps.