更新时间:2022-10-15 18:43:57
Get-ADGroup can do much of what you ask without going away from AD.
Getting this done with the Filter parameter is painful. The LDAP filter however is simple.
For empty groups:
Get-ADGroup -LdapFilter "(!member=*)"
For empty groups which are also not nested inside other groups:
Get-ADGroup -LdapFilter "(&(!memberOf=*)(!member=*))"