Script Repository


Check group type

February 23, 2021
158

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.

Edit Remove
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.

Edit Remove
PowerShell
$groupType = $Context.TargetObject.Get("groupType")
$Context.ConditionIsMet = !($groupType -band [Softerra.Adaxes.Interop.Adsi.ADS_GROUP_TYPE_ENUM]::ADS_GROUP_TYPE_SECURITY_ENABLED)

Comments ( 0 )
No results found.
Leave a comment