WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Samples from Users

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

ADSI Create Group

 Keywords: ADSI Create Group Universal Global Local 

Question:

How do I create groups (universal, global, local) in Active Directory ?

Answer:

AddExtender("wwads44i.dll")

; Group types can be found in constants.wbt
GLOBAL_GROUP       = 2
DOMAIN_LOCAL_GROUP = 4
LOCAL_GROUP          = 4
UNIVERSAL_GROUP    = 8
SECURITY_ENABLED    = 2147483648

; Test ou on our test DC
strAdsiPath = "LDAP://jclass.org/OU=Test OU,DC=jclass,DC=org"

; Create a group object
strObjectClass = "group"
strGroupName   = "cn=Toons"    ;AD requires the Common Name.
strGroupPath   = dsCreateObj(strAdsiPath, strObjectClass, strGroupName)

; Make a global group
strProperty = "groupType"
nValue = GLOBAL_GROUP | SECURITY_ENABLED
dsSetProperty(strGroupPath, strProperty, nValue)

dsSetObj(strGroupPath)

Article ID:   W17541
Filename:   ADSI Create Group.txt
File Created: 2010:03:24:07:19:24
Last Updated: 2010:03:24:07:19:24