Sunday, July 25, 2021

New Groups in AD

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.

Similar articles

Latest Articles

Data Science Market Trends...

When famed mathematician John W. Tukey postulated that advanced computing would have a profound effect on data analysis, he probably didn’t imagine the full...

Data Recovery Market Trends...

Data recovery is more important than ever in this era of constant cyber attacks and ransomware. The Verizon Data Breach Investigations Report (DBIR) looked...

Trends in Data Visualization

In a world of big data, visualization is becoming a key skill set that every business must master.  Digital technology has transformed the way businesses...

Microsoft Data Portfolio Review

With a host of analytics services for almost any situation, Microsoft Azure’s data services have got just about every base covered.   In the world...