2

I am trying to list the users/group members of a specific AD group in Powershell. I dont want to list everyone and everything, just the group members that I am interested in.

For example: I have a AD group called SqlAdmins. I just want to list the members/users in that group.

I tried this: " Get-QADGroup -sizeLimit 0 | select @{name="GroupName";expression={$_.name}} -expand members | select GroupName,@{n='Member';e={ (Get-QADObject $_).name}}" and it listed absolutely everything, but cannot work out how to list for only one group.

Thanks a lot.

3 Answers 3

3

IIRC, it's a simple as:

get-qadgroup sqladmins | get-qadmemberof 

i.e. get the AD group sqladmins, forward it to the next command which will enumerate all members.

As a general guideline for the Quest AD Cmdlets, if you end up writing something as complicated as you did just there for what must seem like a simple task, you're probably doing it wrong ;) Their AD cmdlets are truely excellent.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks, but what I did before, was found on my old mate GOOGLE. I am brand new to using PS, so learning as I go, but this doing it all on one line is a bit confusing.
Try this great free ebook from Keith Hill: Effective PowerhShell - keithhill.spaces.live.com/blog/cns!5A8D2641E0963A97!6930.entry
@ryk do you get any output from "get-qadgroup sqladmins" ?
1

Here is some simple code that will help to query and export the list:

Get-ADGroupMember "nameofthegroup" -recursive | Select-Object SamAccountName | export-csv c:/nameofthefile.csv 

Now I need to know if is possible to exclude people based on another AD Security Group

Comments

0

I just did this:

get-qadgroupmember -identity "group name" 

1 Comment

There seems to be already an accepted answer, may be if you can add some Context to your answer this might help others.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.