Get-ADUser not returning all possible AD attributes when specifying all properties
The following code should return ALL attributes of an AD User (all properties of the ObjectClass=user):
$properties = Get-ADObject -SearchBase (Get-ADRootDSE).SchemanamingContext -Filter {name -eq "User"} -Properties MayContain,SystemMayContain |
Select-Object @{name="Properties";expression={$_.maycontain+$_.systemmaycontain}} |
Select-Object -ExpandProperty Properties
Get-ADUser -Identity username -Properties $properties | fl $properties
Firstly it retrieves and saves all user properties into an array and then secondly the properties array is used with Get-ADUser to retrieve all the properties for a single user (in this example).