下面两个实例可以看出:
Get-ADGroupMember -Identity "CN=gAPCHN-HGZ-IE10-Users,OU=Groups,OU=Hangzhou - China,OU=TCS - China,OU=TCS - China,DC=apac,DC=TCS,DC=com" | select -Property SamAccountName |
ForEach-Object {
Get-ADUser -Identity $PSItem.SamAccountName -Properties * | select DisplayName
}
$SANs = Get-ADGroupMember -Identity "CN=gAPCHN-HGZ-IE10-Users,OU=Groups,OU=Hangzhou - China,OU=TCS - China,OU=TCS - China,DC=apac,DC=TCS,DC=com" | select -Property SamAccountName
Foreach ($PSItem in $SANs) {
Get-ADUser -Identity $PSItem.SamAccountName -Properties * | select DisplayName
}