Commands › Exchange Online
Set-UserPhoto
Configure the user photos feature that allows users to associate a picture with their account. User photos appear in client applications, such as Outlook, Microsoft Teams, and SharePoint. **Note**: In Microsoft 365, you can manage user photos in Microsoft Graph PowerShell. For instructions, see Manage user photos in Microsoft Graph PowerShell.
Quick start script
# Set-UserPhoto — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-ExchangeOnline -CertificateThumbprint $thumb -AppId $appId -Organization $org
# 2. Capture the current state first — you cannot roll back what you never recorded
$before = Get-UserPhoto
$before | Format-List
# 3. Make the change (dry run first)
Set-UserPhoto -Identity <MailboxIdParameter> -Cancel <SwitchParameter> -PictureData <Byte[]> -WhatIf
Set-UserPhoto -Identity <MailboxIdParameter> -Cancel <SwitchParameter> -PictureData <Byte[]>
# 4. Verify and diff
$after = Get-UserPhoto
Compare-Object ($before | Out-String) ($after | Out-String)
Syntax — 5 parameter sets
CancelPhoto
Set-UserPhoto [-Identity] <MailboxIdParameter>
[-Cancel]
[-Confirm]
[-GroupMailbox]
[-DomainController <Fqdn>]
[-IgnoreDefaultScope]
[-PhotoType <String>]
[-UseCustomRouting]
[-WhatIf]
[<CommonParameters>]
UploadPhotoData
Set-UserPhoto [-Identity] <MailboxIdParameter> -PictureData <Byte[]>
[-Confirm]
[-DomainController <Fqdn>]
[-GroupMailbox]
[-IgnoreDefaultScope]
[-PhotoType <String>]
[-UseCustomRouting]
[-WhatIf]
[<CommonParameters>]
UploadPreview
Set-UserPhoto [-Identity] <MailboxIdParameter>
[-PictureData <Byte[]>]
[-PictureStream <Stream>]
[-Preview]
[-Confirm]
[-DomainController <Fqdn>]
[-GroupMailbox]
[-IgnoreDefaultScope]
[-PhotoType <String>]
[-UseCustomRouting]
[-WhatIf]
[<CommonParameters>]
UploadPhotoStream
Set-UserPhoto [-Identity] <MailboxIdParameter> -PictureStream <Stream>
[-Confirm]
[-DomainController <Fqdn>]
[-GroupMailbox]
[-IgnoreDefaultScope]
[-PhotoType <String>]
[-UseCustomRouting]
[-WhatIf]
[<CommonParameters>]
1 more parameter sets — see the parameter table below.
Parameters (12)
Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.