Tag Archives: powerautomate

Powershell GetADUser Name vs DisplayName

When using GetADUser usually we are using the default properties it return. This usually not the case and when we were using it as the property Name it doesn’t update when user’s name got updated. To facilitate this use DisplayName.

This also includes the alias on searching the email of the user. This is helpful if your organization uses multiple domains.

$user = Get-ADUser -Filter * -Properties EmailAddress,DisplayName,Mail,ProxyAddresses,UserPrincipalName | Where-Object { $_.ProxyAddresses -contains “SMTP:[email protected]” -or $_.UserPrincipalName -eq ’[email protected]’ -or $_.EmailAddress -eq ’[email protected]’}

$user.DisplayName