Create domain groups – Jocha

Heres a small VBs script for fast Active Directory group creation.
Paste the following code into a text file and rename it to “CreateADGroups.vbs”.

strGroup = Inputbox("Enter the name of your group:")
If (strGroup = "")  Then
WScript.Echo "Failed!"
Else

' Location where the groups should be created.
Set objOU = GetObject("LDAP://ou=shares,ou=groups,dc=mydomain,dc=local")

' You can choose a prefix/sufflix for your group. In this case "SG" for share group.
Set objGroup1 = objOU.Create("Group", "CN=SG_" & strGroup & "_R")
objGroup1.Put "sAMAccountName", "SG_" & strGroup & "_R"'
objGroup1.SetInfo

' You can create several groups in the same script.
' I chose to create a "R" and "RW" group. (Read and Read/Write).
Set objGroup2 = objOU.Create("Group", "CN=SG_" & strGroup & "_RW")
objGroup2.Put "sAMAccountName", "SG_" & strGroup & "_RW"'
objGroup2.SetInfo

WScript.Echo "Done!"
End If