how can i arrange the display of a powershell query against the ActiveDirectory ?

Hello experts,

I need to query an OU and get all groups and all members of those groups in a display as follow :

group_name, member, objectclass.
blabla, blibli, group
bleble, bloblo, user
....

here's how i can get all the Groups :
$path_to_group = "OU=STD, OU=GROP,OU=bigOU, OU=net, OU=cl"
$groups = Get-ADGroup -SearchBase $path_to_group -filter {GroupCategory -eq "Security"}

then i loop over the groups to get the members as follow
      foreach($group in $groups)
      {
            Get-ADGroupMember -identity $group
      }


questions:
1
do i get all groups in an OU with the filter : -filter {GroupCategory -eq "Security"}
or do i need to change or add another "GroupCategory". ?

2.
how can i arrange a display as already discribed.

group_name, member, objectclass.
blabla, blibli, group
bleble, bloblo, user


thank you in advance.

toshi_
Erwin PombettAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy LidbetterCommented:
For the filter just use *, this will get ALL groups.

$groups = Get-ADGroup -SearchBase $path_to_group -filter *

Open in new window

Erwin PombettAuthor Commented:
Hello Guy,

thank you for your reply.

I already find the groups out of the OU.
Then i'm looping through the groups in order to get all childrens.

What I need is to get all Groups in the OU and recursively continue until i have the users.

thank your for further help
toshi
Erwin PombettAuthor Commented:
I created an output variable as string. then i fillded up with all the values i wanted as an output.

i returned that value. On my command line i piped that content to  

 |Out-File "C:\toMyExportedFile.csv"

toshi

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Erwin PombettAuthor Commented:
i did not receive information concerning the output.....
i dit it on my own.

toshi
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.