Commands › Exchange Online

Get-UserPhoto

Exchange Online ExchangeOnlineManagement Get-*

View information about 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

# Get-UserPhoto — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-ExchangeOnline -CertificateThumbprint $thumb -AppId $appId -Organization $org

# 2. Run and inspect
Get-UserPhoto | Format-List

# 3. Export for evidence / drift tracking
Get-UserPhoto | Export-Clixml .\UserPhoto-$(Get-Date -Format yyyyMMdd).xml

Syntax — 2 parameter sets

AnrSet

Get-UserPhoto [-Anr <String>]
 [-Credential <PSCredential>]
 [-DomainController <Fqdn>]
 [-Filter <String>]
 [-GroupMailbox]
 [-IgnoreDefaultScope]
 [-OrganizationalUnit <OrganizationalUnitIdParameter>]
 [-PhotoType <String>]
 [-Preview]
 [-ReadFromDomainController]
 [-ResultSize <Unlimited>]
 [-SortBy <String>]
 [<CommonParameters>]

Identity

Get-UserPhoto [[-Identity] <MailboxIdParameter>]
 [-Credential <PSCredential>]
 [-DomainController <Fqdn>]
 [-Filter <String>]
 [-GroupMailbox]
 [-IgnoreDefaultScope]
 [-OrganizationalUnit <OrganizationalUnitIdParameter>]
 [-PhotoType <String>]
 [-Preview]
 [-ReadFromDomainController]
 [-ResultSize <Unlimited>]
 [-SortBy <String>]
 [<CommonParameters>]

Parameters (13)

ParameterTypeRequiredWhat it controls
-Identity MailboxIdParameter The Identity parameter specifies the user account. You can use any value that uniquely identifies the user account. For example:
-Anr String The Anr parameter specifies a string on which to perform an ambiguous name resolution (ANR) search. You can specify a partial string and search for objects with an attribute that matches that string. The default...
-Credential PSCredential The Credential parameter specifies the username and password that's used to run this command. Typically, you use this parameter in scripts or when you need to provide different credentials that have the required permissions.
-DomainController Fqdn The DomainController parameter specifies the domain controller that's used by this cmdlet to read data from or write data to Active Directory. You identify the domain controller by its fully qualified domain name...
-Filter String The Filter parameter uses OPATH syntax to filter the results by the specified properties and values. The search criteria uses the syntax `"Property -ComparisonOperator 'Value'"`.
-GroupMailbox SwitchParameter The GroupMailbox switch is required to return Microsoft 365 Groups in the results. You don't need to specify a value with this switch.
-IgnoreDefaultScope SwitchParameter The IgnoreDefaultScope switch tells the command to ignore the default recipient scope setting for the Exchange PowerShell session, and to use the entire forest as the scope. You don't need to specify a value with this switch.
-OrganizationalUnit OrganizationalUnitIdParameter The OrganizationalUnit parameter filters the results based on the object's location in Active Directory. Only objects that exist in the specified location are returned. Valid input for this parameter is an...
-PhotoType String This parameter is reserved for internal Microsoft use.
-Preview SwitchParameter The Preview switch filters the results by preview photos. You don't need to specify a value with this switch.
-ReadFromDomainController SwitchParameter The ReadFromDomainController switch specifies that information should be read from a domain controller in the user's domain. You don't need to specify a value with this switch.
-ResultSize Unlimited The ResultSize parameter specifies the maximum number of results to return. If you want to return all requests that match the query, use unlimited for the value of this parameter. The default value is 1000.
-SortBy String The SortBy parameter specifies the property to sort the results by. You can sort by only one property at a time. The results are sorted in ascending order.

Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.