$all.Properties | ForEach-Object { [PSCustomObject]@{ # attention: property names on right side are case-sensitive! Name = $_.name[0] DN = $_.distinguishedname[0] } } } }
# make sure you specify a valid distinguishedname for a user below Get-NestedGroupMember-distinguishedName'CN=UserName,DC=powershell,DC=local'
PowerShell 技能连载 - 查找嵌套的 Active Directory 成员(第 2 部分)