Script Repository

Check Number of Group Members

January 18, 2016

The script returns True when the number of direct members in the AD group exceed a certain limit. To use it with Adaxes, create a Business Rule triggered before adding a member to a group and add the script using the If PowerShell script returns true condition. Sample Business Rule:


  • $maxMembers - specifies the maximum number of members a group can have.
Edit Remove
$maxMembers = 500 # TODO: modify me

# Get group member GUIDs
    $memberGuidsBytes = $Context.TargetObject.GetEx("adm-MembersGuid")
    # The group has no members
    $Context.ConditionIsMet = $False
    return # Exit script

$Context.ConditionIsMet = $memberGuidsBytes.Length -ge $maxMembers

Comments ( 0 )
No results found.
Leave a comment

Related Scripts