Universal Distribution Group creation.

Discussion in 'Scripting' started by ToddDtown, Dec 14, 2004.

  1. ToddDtown

    ToddDtown Guest

    I am trying to write a script to create users and groups and I need to create
    groups that are of type - Distribution and of scope - Universal in order to
    nest my groups. This is the code that I tried running but fails.

    Const Domain = "SomeDomain"
    Const ADS_GROUP_TYPE_UNIVERSAL_GROUP = &h8

    Set objDomain = GetObject("WinNT://" & Domain)
    Set objGroup = objDomain.Create("Group", "Some Group")

    objGroup.Put "sAMAccountName", "somegroup"
    objGroup.Put "groupType", ADS_GROUP_TYPE_UNIVERSAL_GROUP
    objGroup.SetInfo

    When I use &h2 for the groupType to create a new Global Security group it
    works fine, however it won't let me create the Universal Distribution group.
    The error I get states that "One or more input parameters are invalid",
    referring to this line of code:

    objGroup.Put "groupType", ADS_GROUP_TYPE_UNIVERSAL_GROUP

    Any help would be much appreciated, thank you.
     
    ToddDtown, Dec 14, 2004
    #1
    1. Advertisements

  2. IMHO, windows NT4 knows nothing about universal groups, so you may need to
    switch from the WinNT provider to LDAP, assuming you are running active
    directory, that is.

    Also, if you are running *native* active directory, you do not need to use
    universal groups to nest them, as this can be done with global and domain
    local groups.

    /Al
     
    Al Dunbar [MS-MVP], Dec 15, 2004
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.