Introduction - Creating Global Groups with WSH
The purpose of this script is to create a new Global group. My example
uses an OU called BulkImport, a domain called CP.com and a Global group called
Managers. Do change these
variables to names in your Active Directory.
WSH Topics
To prevent the Global group being created in the Users container we specify
the OU. This is taken care of by this line: Set oOU=oDomain.Create("organizationalUnit",
"ou=BulkImport")
Note: The syntax is OU=BulkImport (Not CN=BulkImport or CN =
Users)
Note: The script does not create the OU BulkImport, either make it manually
or change the script to an OU that does exist. (However there instructions
in the WSH Create User if you want to create an OU.)
Note: You must change dc=CP to dc=xxxxxxx where xxxxxxx is your domain name.
Also check whether or not your domain has a com extension. If it does not,
and is just a plain domain, remove the element dc=com
- Copy the entire Script in the green box below.
- Paste it into notepad.exe.
- File (menu), Save as Managers.vbs. Note: This is where people go
wrong, remember the .vbs extension.
- Double click Managers.vbs
- Go to Active Directory Users and Computers OU BulkImport, Press F5.
'Script to Create a Global Group in an OU called BulkImport
'Script created by Guy Thomas
'Feel free to adapt names
Set objOU = GetObject("LDAP://OU=BulkImport, dc=CP, dc=com")
Set objGroup = objOU.Create("Group", "CN=Managers")
objGroup.Put "sAMAccountName", "Managers"
objGroup.SetInfo
WScript.Echo "Congratulations, Global Group Managers created & Chr(13) Remember to Press F5"
If you get an error message -
check this page |