We help IT Professionals succeed at work.
Get Started

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

Erwin Pombett
on
47 Views
Last Modified: 2015-04-04
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_
Comment
Watch Question
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE