Compare-UserAttribute
SYNOPSIS
Compare two user attributes from different sources.
SYNTAX
Compare-UserAttribute [-Attribute1] <String> [-Attribute2] <String> [-Source] <String> [[-User] <String[]>]
[[-ByDomain] <String[]>] [-Return] <String> [-ProgressAction <ActionPreference>] [<CommonParameters>]
DESCRIPTION
This function compares two specified user attributes from Active Directory, Entra ID (Microsoft Graph), or Exchange. It can filter users based on email domain or specific user identities and returns users whose attributes either match or do not match.
EXAMPLES
EXAMPLE 1
Compare-UserAttribute -Attribute1 "mail" -Attribute2 "proxyAddresses" -
Compares the 'mail' and 'proxyAddresses' attributes for users in Active Directory and returns those with matching values.
EXAMPLE 2
Compare-UserAttribute -Attribute1 "userPrincipalName" -Attribute2 "mail" -Source "EntraID" -Return "NotMatching"
Compares the 'userPrincipalName' and 'mail' attributes for users in Entra ID and returns those with non-matching values.
PARAMETERS
-Attribute1
The first user attribute to compare.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Attribute2
The second user attribute to compare.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Source
The source from which to retrieve user information. Valid options are 'AD' for Active Directory, 'EntraID' for Microsoft Entra ID, and 'Exchange' for Exchange.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-User
An array of user identities to filter the comparison.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ByDomain
An array of email domains to filter users.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Return
Specifies whether to return users with 'Matching' or 'NotMatching' attributes.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 6
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ProgressAction
{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.