11 Nov 2013 @ 8:13 AM 

Groups with no members in them are, in my opinion, a waste of a perfectly good object ;-)
So here is a function to find groups that have no users and no groups as member…

function Get-EmptyGroups {
    $Groups = Get-ADGroup -Filter * -Properties members
    foreach ($Group in $Groups) {
        $GroupMembers = $Group | Select-Object -ExpandProperty members
        if ($groupmembers -eq $null) {
            $Group.Name
        }
    }
}
Posted By: Jeff Wouters
Last Edit: 11 Nov 2013 @ 02:22 PM

EmailPermalink
Tags



 Last 50 Posts
 Back
Change Theme...
  • Users » 1
  • Posts/Pages » 329
  • Comments » 471
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

About



    No Child Pages.

Contact



    No Child Pages.

Speaking



    No Child Pages.

Health Check



    No Child Pages.