Help with GetadGroupMember and GetADuser

i need help, i am not a programmer so pls be kind..:)

i have a powershell script i run to pull Names for all members of specific AD Groups, what i need to do is add their details to the output file.  Wha i need is their group meber name which for us is their login name, followed by First Name, Last Name and email address in one spreadsheet.  this is my command for the group members 

get-adGroupMember -identity "grroupname" | Select name | Export-csv -path c:\Output\SNUsersSB.csv

i have tried searching online and piping in the GetADUser command but it keeps failing, this is what i have tried, among a few other variations but i get errors.  I know the user data is there for each user i just dont know how to pull it

Get-adGroupMember -identity "B1G-ServiceNow_SNUsersSB" | Select name | Get-ADUser -properties Firstname,Lastname | Select Name,Firstname,Lastname | Export-csv -path c:\Output\SNUsersSB1.csv

the error

Get-ADUser : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of
the parameters that take pipeline input.
At line:1 char:72
+ ... SB" | Select name | Get-ADUser -properties Firstname,Lastname | Selec ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (@{name=B1JCS05}:PSObject) [Get-ADUser], ParameterBindingException
+ FullyQualifiedErrorId : InputObjectNotBound,Microsoft.ActiveDirectory.Management.Commands.GetADUser

Parents
No Data
Reply
  • i finally figured it out...

    get-adGroupMember -identity "GROUPNAME" | Get-ADUSer -properties Displayname,Description,Mail |
    Select Name,Description,Mail | Export-csv Prod.csv

    i need a little more help, within one of my AD groups there are nested groups, which dont have AD user properties, i want to include them in the report but they are being omitted.  how cn i structure the command to only pull ADuser properties from non-groups, skip the nested group names but include the group name in the results?

Children
No Data