Powershell function to list AD groups with no members
Below PowerShell function lists AD groups with no members in them.
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
}
}
}
0 comments :