This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Dynamic groups and powershell

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.
Parents
  • 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()
Reply
  • 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()
Children
No Data