Welcome to ServerForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Creating groups in child OUs

 
   Windows Server (Home) -> Windows Server Scripting RSS
Next:  copying folders to new loc and renaming folder to..  
Author Message
Shashi

External


Since: Jun 01, 2006
Posts: 1



(Msg. 1) Posted: Thu Jun 01, 2006 1:25 am
Post subject: Creating groups in child OUs
Archived from groups: microsoft>public>windows>server>scripting (more info?)

Hallo,
Here I am trying to crate a group in child ou but I get error"There is no
such object on the server".
Can anyone help me out.
Set objOU =
GetObject("LDAP://ou=R&D,ou=users,ou=Local,dc=NA,dc=fabrikam,dc=com")
Set objGroup = objOU.Create("Group", "cn=Scientists")

objGroup.Put "sAMAccountName", "scientists"
objGroup.Put "groupType", ADS_GROUP_TYPE_GLOBAL_GROUP
objGroup.SetInfo

Thanks
Shashi

 >> Stay informed about: Creating groups in child OUs 
Back to top
Login to vote
Daniel Giraud

External


Since: Jun 04, 2006
Posts: 13



(Msg. 2) Posted: Thu Jun 01, 2006 10:56 am
Post subject: Re: Creating groups in child OUs [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

users is not an ou but a cn :
should look like this
LDAP://ou=R&D,cn=users,ou=Local,dc=NA,dc=fabrikam,dc=com

"Shashi" <Shashi DeleteThis @discussions.microsoft.com> a écrit dans le message de news:
3616EFB3-5B38-4B20-BAE7-6323D3914E03 DeleteThis @microsoft.com...
> Hallo,
> Here I am trying to crate a group in child ou but I get error"There is no
> such object on the server".
> Can anyone help me out.
> Set objOU =
> GetObject("LDAP://ou=R&D,ou=users,ou=Local,dc=NA,dc=fabrikam,dc=com")
> Set objGroup = objOU.Create("Group", "cn=Scientists")
>
> objGroup.Put "sAMAccountName", "scientists"
> objGroup.Put "groupType", ADS_GROUP_TYPE_GLOBAL_GROUP
> objGroup.SetInfo
>
> Thanks
> Shashi
>
>

 >> Stay informed about: Creating groups in child OUs 
Back to top
Login to vote
Eng

External


Since: Nov 24, 2004
Posts: 12



(Msg. 3) Posted: Mon Aug 21, 2006 3:15 am
Post subject: Re: Creating groups in child OUs [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Use this:

This script is composed by 3 file

1 input.txt the input file is used to retrieve the object name
2 the batch used to "run" the vbs and take the information from the txt
3 the VBS file NewGroups.vbs

The file BAT create a series of groups from
the file input.txt. (use " " for the name of the groups)

The groups will be created BY DEFAULT into OU=GROUPS
if you specify inside the .vbs file the path where you
want to create groups it will works for every OU.

'****************************************************************************
'* 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"
'*****************************************************************************
'*****************************************************************************
'*****************************************************************************

That's all.

Script by: Eugenio Talarico
mailto: eugeniot @ _R_E_M_O_V_E___ larico.it

so here the structure:

1 input.txt

GROUPS_NAME;Comment

2 BATCH FILE

@echo on

echo ****************************************
Echo * script for multiple groups creation *
echo ****************************************


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

3 VBS FILE NewGroups.vbs

'****************************************************************************
'*
'* 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
 >> Stay informed about: Creating groups in child OUs 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
tool to enumerate users , groups, shares + ntfs on windows.. - I have seen some tools to list users, and groups but i need a tool to list all the ntfs permissions, shares, local groups on member servers, and global groups etc domain wide. thanks

Script and request for comments: Creating shell-level vari.. - (Follow-up set to microsoft.public.scripting.wsh). Yet another script written in connection with the Windows Deployment Resource Kit coming soon from Microsoft Press. ===================================================================== One of the minor...

Listing groups and users from folders - I need help in creating a script that can list all the user and group memberships of a given folder. This wll also apply to subfolders beneath the root folder. Info needs to be extracted to a file. Thanks, Randolph

Creating user with Exchange features - All your answers have been great and Richard Mueller, you the man. My last problem for this script newuser.vbs script is that I create the Active Directory User, but when you look at the users properties he doesn't have a Email Address Tab or..

creating domain users - I have a work station with 2000 pro is in a domain. how can i create another administrator user.
   Windows Server (Home) -> Windows Server Scripting All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]