VBS to Create a Global Security Group in Active Directory

The below script will create a single Global Security group in Active Directory.

– Change “LDAP://ou=HR,dc=NA,dc=fabrikam,dc=com to your domain and the OU where you want the group created

– Change “cn=Test” and “sAMAccountName” to the name of the group

– Change “Just a test group” to the description of the group

Const ADS_GROUP_TYPE_GLOBAL_GROUP = &h2
Const ADS_GROUP_TYPE_SECURITY_ENABLED = &h80000000
 
Set objOU = GetObject("LDAP://ou=HR,dc=NA,dc=fabrikam,dc=com")
Set objGroup = objOU.Create("Group", "cn=Test")
 
objGroup.Put "sAMAccountName", "Test"
objGroup.Put "description", "Just a test group"
objGroup.Put "groupType", ADS_GROUP_TYPE_GLOBAL_GROUP Or ADS_GROUP_TYPE_SECURITY_ENABLED
 
objGroup.SetInfo

 

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.