is there any way to create and configure dynamic groups via powershell script? I don't see any cmdlets in the management shell that address dynamic groups.
I already tried this - I'd worked out that teh attributes were and you cannot update them, I even spent time reverse engineering the attributes so I can work out what the rules are. I had to do this before I tried to update the attributes directly. The SDK only has vbscript examples :-( .
I've since come across a post that converts the vbscript example to Powershell and I can confirm this works:
where $newGroup is the object create when creating the new group and
$qbdls is an object that holds the searchbase and ldapquery to use
$objGroup = [ADSI] "EDMS://<ARSServerName>/$($newGroup.DN)"
# Return a reference to membership rule collection for this group
$objRuleCollection = $objGroup.MembershipRuleCollection
# Create a new 'Include by Query' rule
$rule1 = New-Object -ComObject "EDSIManagedUnitCondition"
$rule1.Base = "EDMS://$($qbdls.msexchdynamicdlbasedn)"
$rule1.Filter = $($qbdls.msexchdynamicdlfilter)
$rule1.Type=1 # 'Include by Query'
# Add a newly created rule to the rule collection
$objRuleCollection.Add($rule1)
$objGroup.SetInfo()
I already tried this - I'd worked out that teh attributes were and you cannot update them, I even spent time reverse engineering the attributes so I can work out what the rules are. I had to do this before I tried to update the attributes directly. The SDK only has vbscript examples :-( .
I've since come across a post that converts the vbscript example to Powershell and I can confirm this works:
where $newGroup is the object create when creating the new group and
$qbdls is an object that holds the searchbase and ldapquery to use
$objGroup = [ADSI] "EDMS://<ARSServerName>/$($newGroup.DN)"
# Return a reference to membership rule collection for this group
$objRuleCollection = $objGroup.MembershipRuleCollection
# Create a new 'Include by Query' rule
$rule1 = New-Object -ComObject "EDSIManagedUnitCondition"
$rule1.Base = "EDMS://$($qbdls.msexchdynamicdlbasedn)"
$rule1.Filter = $($qbdls.msexchdynamicdlfilter)
$rule1.Type=1 # 'Include by Query'
# Add a newly created rule to the rule collection
$objRuleCollection.Add($rule1)
$objGroup.SetInfo()