Created
April 15, 2020 22:00
-
-
Save zaskem/e182363868cd685547553cd8a2f5588c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$groups = Get-ADGroup -Filter 'Name -like "PATTERNGOESHERE*"' | Select-Object Name, SamAccountName; | |
"There are "+ $groups.Count +" matching groups."; | |
$groupDetails = ForEach ($grp in $groups) { | |
New-Object PSObject -Property @{'Group Name'=$grp.Name;Count=(Get-ADGroupMember $grp.SamAccountName -Recursive).Count}; | |
} | |
$groupDetails | Sort-Object -Property Count -Descending | Select-Object 'Group Name', Count; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment