Create group v2 (VBScript)
This code can be found in
Chapter 23 of Active Directory, 3rd Edition
Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.
Find out how to download all of the VBScript code from this site.
' From the book "Active Directory, Third Edition"
' ISBN: 0-596-10173-2
Option Explicit
Dim objDomain, objGroup, objComputer
'Creating a group in a Windows NT domain
Set objDomain = GetObject("WinNT://MYDOMAIN")
Set objGroup = objDomain.Create("group","MyGroup")
ObjGroup.SetInfo
'Creating a local group on a computer or member server
'Valid for Windows NT, Windows 2000 and Windows Server 2003
Set objComputer = GetObject("WinNT://MYCOMPUTER")
Set objGroup = objComputer.Create("group","My Group")
ObjGroup.SetInfo
'Creating a group in Active Directory
Set objDomain = GetObject("LDAP://cn=Users,dc=mycorp,dc=com")
Set objGroup = objDomain.Create("group","cn=My Group")
ObjGroup.Put "sAMAccountName", "MyGroup"
ObjGroup.SetInfo
|
This code has been viewed 2457 times.
|
New from the creators of TechTasks.com:
StatSheet.com
|