Computer Performance, Windows 2003, Logon Scripts

Google

WebSearch Site

 Home
Subscribe to Newsletter
WSH - Home
WSH - Simple Script
WSH - Create User
WSH - Bulk Import
WSH - Create Group
WSH - Create Contact
WSH - FSO Create File
WSH - List Members
WSH - Error Messages
VBScript Home
Logon Script Home
CSVDE & LDIFDE
 LDAP Attributes

 

 More Sections
 Guy's eBooks
 Windows 2003
 Exchange 2003 (New)
 Performance Monitor

 

 Windows 2000 AD
 Exchange 2000
 SQL Server 2000
 SharePoint Portal

 

 Litmus Tests
 Registry Hacks
 Problem Solving
 On-line advice
 Free ebooks

 

Contact Guy
About Us
Online Jobs at CP
Guy's eBooks

 

 

WSH - Create Groups

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

Create the Global Group

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.)

˚

Set the Group Object

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

Instructions

  1. Copy the entire Script in the green box below.
  2. Paste it into notepad.exe.
  3. File (menu), Save as Managers.vbs.   Note: This is where people go wrong, remember the .vbs extension.
  4. Double click Managers.vbs
  5. 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

 


See Also

 *


Google

Webcomputerperformance.co.uk

GFi Events Manager

Guy Recommends: GFi EventsManager

Here is a solution to monitor, manage and archive thousands of events that are generated by devices across your entire network.  Get your free evaluation copy of GFI EventsManager.

 

Home Copyright © 1999-2008 Computer Performance LTD All rights reserved

Please report a broken link, or an error.