How to get email alias and CN for everyone in an AD group using PowerShell

I use PowerShell with Quest AD cmdlets.

I can use the Get-QADGroupMember cmdlet to get a list of everyone in this group. So far so good, but I would like to get their email alias. All that is being returned at present is something like:

Name      Type  DN
----      ----  --
Jane Doe  User  CN=Jane Doe,OU=Employee,DC=companyname,DC=com
Job Blow  User  CN=Joe Blow,OU=Employee,DC=companyname,DC=com

I tried using get-qaduser with the -includeallproperties flag, but I still only get the above fields and don’t know how to get the returned data, which, according to the documentation, is cached on the computer.

Any help would be appreciated.

UPDATE

I ended up using "select" as shown below:

$everyone = Get-QADGroupMember "All employees" | select firstname, lastname, email

, , -. , , , :

for ($i=0; $i -le $everyone .length-1; $i++)
{
    write-host $everyone[$i].email
}

, "." -. , , , . , , - - !

+3
2

, ? Get-Member Format-List -Force *? PowerShell , , .

Select-Object select, , , PowerShell :

Some-Command | select Name, Type, DN, SomeOtherProperty

, , Get-ChildItem:

PS Home:\> gci *.ps1


    Directory: C:\Users\Joey


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---        2011-04-27     18:50        169 format.ps1
-a---        2011-04-26     18:36       1064 Untitled1.ps1
-a---        2011-04-27     18:41         69 x.ps1
-a---        2011-04-23     19:58         91 y.ps1

: Mode, LastWriteTime, Length Name. , Get-Member.

PS Home:\> gci *.ps1|gm -MemberType Property


   TypeName: System.IO.FileInfo

Name              MemberType Definition
----              ---------- ----------
Attributes        Property   System.IO.FileAttributes Attributes {get;set;}
CreationTime      Property   System.DateTime CreationTime {get;set;}
CreationTimeUtc   Property   System.DateTime CreationTimeUtc {get;set;}
Directory         Property   System.IO.DirectoryInfo Directory {get;}
DirectoryName     Property   System.String DirectoryName {get;}
Exists            Property   System.Boolean Exists {get;}
Extension         Property   System.String Extension {get;}
FullName          Property   System.String FullName {get;}
IsReadOnly        Property   System.Boolean IsReadOnly {get;set;}
LastAccessTime    Property   System.DateTime LastAccessTime {get;set;}
LastAccessTimeUtc Property   System.DateTime LastAccessTimeUtc {get;set;}
LastWriteTime     Property   System.DateTime LastWriteTime {get;set;}
LastWriteTimeUtc  Property   System.DateTime LastWriteTimeUtc {get;set;}
Length            Property   System.Int64 Length {get;}
Name              Property   System.String Name {get;}
0

, select-object .

, :

$test = get-qaduser atestuser | select-object name

$test PSCustomObject (System.Object), .

? ... ?

- :

get-qadgroupmember "domain users" | format-table name, displayname, email

get-qadgroupmember "domain users" | select-object name, displayname, email | Export-Csv c:\acsvfile.csv
0

All Articles