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.

$user= Get-ADUser -Filter {UserPrincipalName -eq ’[email protected]’ -or EmailAddress -eq ’[email protected]’} -Properties EmailAddress,DisplayName

$user.DisplayName

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.