Question Locked

Creating Multiple Security Groups Script

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Does anyone know how to script the creation of multiple security groups in AD?

I have a script that works fine creating one group for a class in our school:

Const ADS_GROUP_TYPE_LOCAL_GROUP = &h2
Const ADS_GROUP_TYPE_SECURITY_ENABLED = &h80000000

Set objOU = GetObject("LDAP://ou=classes,ou=students,ou=managed users,dc=mydomain,dc=com")
Set objGroup = objOU.Create("Group", "cn=12aMs")

objGroup.Put "sAMAccountName", "12aMs"
objGroup.Put "groupType", ADS_GROUP_TYPE_LOCAL_GROUP Or _
ADS_GROUP_TYPE_SECURITY_ENABLED
objGroup.SetInfo

However i need to create groups for all of our classes, is there way of copying that, pasting it below and changing the class name in the script and getting it to run again?

Or pulling the names from CSV and then creating them all?

Many thanks.

1 reply

This discussion is closed to new replies.