grant additional accounts the write members property

Discussion in 'Scripting' started by Lieka Heineken, Apr 8, 2008.

  1. The below script reads input from an excel worksheet and creates a global
    distribution list. I am seeking to have it read accounts to be granted the
    write members property on the security of the object. I would also like it to
    check the box can modify members on the managed by tab and set the exchange
    attributes...

    -----------------------------------------------------------
    Set objExcel = CreateObject("Excel.Application")
    Set objWorkbook = objExcel.Workbooks.Open _
    ("C:\Scripts\script_input.xls")

    intRow = 3 'intiatiates reading from the 3rd row of the above spreasheet

    Const ADS_GROUP_TYPE_GLOBAL_GROUP = &h2

    Do Until objExcel.Cells(intRow,1).Value = "" 'does below task until first
    column of the row being read is blank

    strDL = Trim(objExcel.Cells(intRow, 1).Value)
    strOwner = Trim(objExcel.Cells(intRow, 2).Value)
    strManageby = Trim(objExcel.Cells(intRow, 3).Value)

    Set objOU = GetObject("LDAP://ou=accounts,dc=domain,dc=com") 'binds to the
    active directory container accounts in the domain domain.com
    Set objGroup = objOU.Create("Group", "cn=" & strDL) 'creates a group with
    the name of variable

    objGroup.Put "sAMAccountName", strDL
    objGroup.Put "groupType", ADS_GROUP_TYPE_GLOBAL_GROUP
    objGroup.Put "info", "OWNER/APPROVER = " & strOwner
    objGroup.Put "Description", "OWNER/APPROVER = " & strOwner
    objGroup.Put "managedBy", strManageby

    objGroup.SetInfo


    intRow = intRow + 1
    Loop


    objExcel.quit
    wscript.echo "Complete"
     
    Lieka Heineken, Apr 8, 2008
    #1
    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.