11544

IT Management Daily
Storage Daily
Security Daily
FREE NEWSLETTERS
search
 

follow us on Twitter


internet.commerce
Be a Commerce Partner

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Products
 Barcode for Libraries (Barcode for libraries)
 RecoveryFix for OST (Data Recovery Fix)
 Easy RAR Recovery (MunSoft)
 Word Recovery (Word Recovery)
 Bulletproof Public PC (Pc-Safety)
 Fix Outlook Errors (Fix Outlook Errors)
» Enterprise IT Planet » Resources » Win Scripts

New Groups in AD

June 8, 2004

Email Print Digg This Add to del.icio.us
Author: Eugenio Talarico
Platform: Windows
Type: VBScript

DESCRIPTION: You can use to create multiple groups into OU=GROUPS using this line in a batch file:

for /F "tokens=1-2 usebackq delims=;" %%1 in (input.txt) do ( cscript NewGroups.vbs %%1 %%2 //B //Nologo >> err_log.txt 2>>&1 )

The context of the input file is name_of_the_groups;comment Scroll down to view the script.


''****************************************************************************
''*
''* Create a new groups in an Active Directory Infrastructure
''*
''* Created By Eugenio Talarico - 10/12/2003
''*
''****************************************************************************
''* THe sintax you have to use to run the script is
''* cscript newgroups.vbs NAME_OF_THE_GROUPS 
''* Name_of_the_groups rappresent the groups you need to create
''*****************************************************************************
''*****************************************************************************
''* INTO STRVARIABL LINE PUT THE PATH WHERE THE GROUPS 
''* WILL CREATED (EX: strVariabl = ",OU=Standard Users,OU=DomainNAME,")
''*****************************************************************************
''*****************************************************************************
strVariabl = "OU=groups"
''*****************************************************************************
''*****************************************************************************
''*****************************************************************************
''**Start Encode**
dim nome
dim Commento
ParseCommandLine()
wscript.echo nome
Const ADS_PROPERTY_APPEND = 3 
Set objRootDSE = GetObject("LDAP://rootDSE")
strFissa = strVariabl & "," & objRootDSE.Get("defaultNamingContext")
wscript.echo strFissa
Set objGroup = GetObject _
("LDAP://"& strFissa)
Set objGroup = objGroup.Create ("group", "CN=" & nome)
objGroup.Put "sAMAccountName", nome
ObjGroup.Put "Description", commento
objGroup.SetInfo
Sub ParseCommandLine()
    Dim vArgs
    set vArgs = WScript.Arguments
    if vArgs.Count <> 2 then 
        DisplayUsage()
    Else
        nome = vArgs(0)
        commento = vArgs(1)
    End if
End Sub

Disclaimer: We hope that the information in these pages is valuable to you. Your use of the information contained in these pages, however, is at your sole risk. All information on these pages is provided "as - is", without any warranty, whether express or implied, of its accuracy, completeness, fitness for a particular purpose, title or non-infringement, and none of the third-party products or information mentioned in the work are authored, recommended, supported or guaranteed by me. I shall not be liable for any damages you may sustain by using this information, whether direct, indirect, special, incidental or consequential, even if it has been advised of the possibility of such damages.

Email Print Digg This Add to del.icio.us

Win Scripts Archives