Welcome to ServerForumz.com!
FAQFAQ    SearchSearch      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" a écrit dans le message de
3616EFB3-5B38-4B20-BAE7-6323D3914E03.RemoveThis@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:
Creating groups in AD - New to VB /WMI scripting. I need to do the following: 1. Check whether a Global Security Group exists in an OU and create it if it doesn't exist. 2. Retrieve the SID of the Global Security Group thus created ( or already existing) 3. Write the SID of..

Scripting out and re-creating users and groups of windows - Hi, We are maintaining backup server with Windows 2000 Advanced server. I have issue of transferring User and group with their permission. I can do it manually by looking at each user properties. Does anyone suggest me any tools or scripts which....

Spawn a child process in WSH or WMI - I am trying to create a script that monitors the typeperf.exe command and runs as a service. I need to spawn typeperf.exe as a child process to the script or wscript.exe. I should be able to do this with the exec command. However the exec command..

enumerating child domain - Set objRootDSE = GetObject("LDAP://RootDSE") strDNSDomain = objRootDSE.Get("defaultNamingContext") wscript.echo strdnsdomain This gives me DC=x,DC=domain,DC=com how can I get this: DC=y,DC=x,DC=domain,DC=com ? y is a child dom...

Uregnt - Query Child containers. - I have written a VBS to modify user attributes, modelled on code found at the MS scripting center. Our "Users" container has 4 child containers. Currently I have to run the script against each child container individually. Is there any wa...
   Windows Server (Home) -> Windows Server Scripting All times are: Pacific Time (US & Canada)
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 ]