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
John EsraeloDatabase / SQL DeveloperAsked:
Who is Participating?
 
John EsraeloConnect With a Mentor Database / 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:
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 McCauleyData and Analytics ManagerCommented:
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 found the answer without using the .Net therefore.  Practically did not get an answer that I was looking for.
0
All Courses

From novice to tech pro — start learning today.