Code Script .co.uk

Home | Scripts | Tutorials | Disclaimer | Sitemap | Contact

   Create Group
 

Vbscript / Active Directory / Create Group

This script creates a global security group in the specified OU.


CreateGroup "OU=users,OU=students,", "students"


Sub CreateGroup(strOU, strGroup)

strGroupCN = "CN=" & strGroup

Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("DefaultNamingContext")

Set objOU = GetObject("LDAP://" & strOU & strDNSDomain )

Set objGroup = objOU.Create("Group",strGroupCN)
objGroup.Put "sAMAccountName", strGroup
objGroup.setInfo

End Sub





Please note that a disclaimer applies to any code on this page.
 
   Actions
  Go Back
  Bookmark
  Print Page


   Menu
 
- Links
- Reference
- Script Editors
- Tutorials
- Vbscript
     - Active Directory
          - Ad User Information Query
          - Add Machine To Domain
          - Add User To Group
          - Create Group
          - Create Ou Structure
          - Enumerate Ad Users
          - Enumerate Group Members
          - Move Users And Groups Between Ous
          - Raise Domain Functional Level
     - Exchange
     - Files And Folders
     - General
     - Ms Office
     - Operating System
     - Processes And Services
     - Text Processing
     - User Interaction
     - Web Servers