Okei, then I will trigger it another way.
I have found the following code to add a user to a rule-based group:
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")
# Connect to the Adaxes service
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly("localhost")
# Bind to the group
$groupDN = "CN=My Group,OU=Groups,DC=company,DC=com"
$group = $service.OpenObject("Adaxes://$groupDN", $null, $null, 0)
# Add membership rule for user 'John Smith'
$userDN = "CN=John Smith,CN=Users,DC=company,DC=com"
$user = $service.OpenObject("Adaxes://$userDN", $null, $null, 0)
$rules = $group.MembershipRules
$includeRule = $rules.Create("ADM_BUSINESSUNITMEMBERSHIPTYPE_SPECIFIC")
$includeRule.Exclude = $false
$includeRule.Object = $user
$rules.Add($includeRule)
$group.MembershipRules = $rules
# Save the changes
$group.SetInfo()
Can the code be customised to add all users of a group?
If so, is it also possible to add multiple rules?
In other words, is it possible to add a script that adds the following rule (members of groups):