We help IT Professionals succeed at work.

PowerShell - getting each AD Group Member information

garryshape
garryshape asked
on
Get-QADGroupMember Group1 | ForEach-Object{get-qaduser}

Open in new window

Using Quest ActiveRoles, when I run the above command, it runs get-qaduser against every user in the ActiveDirectory database, instead of running against each user I just called from "Group1".
Am I missing something?

I'm trying to get this script to work for all users in the group, as well as all users within each subgroup of the group (is that also possible)?
Comment
Watch Question

Infrastructure Architect
Commented:
Let me know what you are looking for.
If you want to list out all users in a group (Direct and indirect), try this commandlet.

Get-QADGroupMember -Indirect -Identity group1
Krzysztof PytkoSenior Active Directory Engineer
Top Expert 2012
Commented:
Have you tried with

Get-QADGroup "GroupName" | Get-QADGroupMember -Indirect -SizeLimit 0 | Get-QADUser | Select SamAccountName,givenName,sn,description

Regards,
Krzysztof

Author

Commented:
What I was going to try and to is get each members Manager name. I thought manager would just be "Manager" in AD

Author

Commented:
Ok it is but manager comes back as Distringuished name do you know how to get it to return as Manager's display name

Author

Commented:
Out-File report.csv puts everything into one column .

Author

Commented:
I think that works. Formatting's not a huge deal, I can text-to-column within Excel.

I'd really be interested to know if you could put in the file which group each member's a part of.