Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 188
  • Last Modified:

ADSI: EmptySecurityGroups_DistributionGroup::

Hi Team,
Is there a way to list all empty ADSI LDAP security groups and/or distribution groups in an active directory?

thx

JohnE
0
John Esraelo
Asked:
John Esraelo
  • 3
1 Solution
 
John EsraeloDatabase / SQL DeveloperAuthor Commented:
This is, for instance, a nice one to get the admins in the domain.
I wonder if there is a simple way of getting a list of "empty" security groups and distribution groups.  (got this from a site a few minutes ago)

$Recurse = $true

Add-Type -AssemblyName System.DirectoryServices.AccountManagement
$ct = [System.DirectoryServices.AccountManagement.ContextType]::Domain
$group=[System.DirectoryServices.AccountManagement.GroupPrincipal]::FindByIdentity($ct,'Administrators')
$group.GetMembers($Recurse)

Open in new window

0
 
Ryan McCauleyCommented:
I wrote a quick app in .NET once that will list all the groups with duplicate members in it - you could use that to identify all the groups that had no members (pick an empty group you know of and have it find all the matching groups). If nobody else posts a better solution, I could find a copy of the tool and upload it.

I'm not sure how you'd do it with powershell though.
0
 
John EsraeloDatabase / SQL DeveloperAuthor Commented:
I have actually go an answer without using .Net and strictly using PowerShell .

Thank though.

JohnE
0
 
John EsraeloDatabase / SQL DeveloperAuthor Commented:
I have found the answer without using the .Net therefore.  Practically did not get an answer that I was looking for.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now