The scripts are used to check the type of the target group. To execute the scripts, use the If PowerShell script returns true condition in a custom command, business rule or scheduled task configured for the Group object type.
Script 1: Security group
The script returns true if the target group is a Security group.
PowerShell
$groupType = $Context.TargetObject.Get("groupType")
$Context.ConditionIsMet = $groupType -band [Softerra.Adaxes.Interop.Adsi.ADS_GROUP_TYPE_ENUM]::ADS_GROUP_TYPE_SECURITY_ENABLED
Script 2: Distribution group
The script returns true if the target group is a Distribution group.
PowerShell
$groupType = $Context.TargetObject.Get("groupType")
$Context.ConditionIsMet = !($groupType -band [Softerra.Adaxes.Interop.Adsi.ADS_GROUP_TYPE_ENUM]::ADS_GROUP_TYPE_SECURITY_ENABLED)