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

group membership

 
   Windows Server (Home) -> Windows Server Scripting RSS
Next:  PowerShell Questions  
Author Message
codeye23

External


Since: Jul 26, 2006
Posts: 3



(Msg. 1) Posted: Wed Jul 26, 2006 8:16 am
Post subject: group membership
Archived from groups: microsoft>public>windows>server>scripting (more info?)

is there an easy way that is script based to modify the group
membership of everyone in an OU? i.e add all the users in the Customer
Services OU to the customer services securtity group. I have a script
that creates the user and adds an email address but I need to be able
add the newusers to a group.

Thanks

J

 >> Stay informed about: group membership 
Back to top
Login to vote
Babu VT

External


Since: Jul 25, 2006
Posts: 17



(Msg. 2) Posted: Wed Jul 26, 2006 8:04 pm
Post subject: Re: group membership [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi,

Check this out,

' GroupAddLots.vbs
' Sample VBScript to add users to a group.
' Author Guy Thomas
' Version 2.3 - May 2005
' ---------------------------------------------------------------'
Option Explicit
Dim objRootLDAP, objGroup, objUser, objOU
Dim strOU, strGroup, strDNSDomain
Dim intCounter

' Check these objects referenced by strOU, strGroup exist in strOU
strOU = "OU=Newport,"
strGroup = "CN=Coal Porters,"

' Bind to Active Directory and get LDAP name
Set objRootLDAP = GetObject("LDAP://RootDSE")
strDNSDomain = objRootLDAP.Get("DefaultNamingContext")

' Prepare the OU and the Group
Set objGroup = GetObject("LDAP://"& strGroup _
& strOU & strDNSDomain)
Set objOU =GetObject("LDAP://" & strOU & strDNSDomain)

' On Error Resume next
intCounter = 1
For Each objUser In objOU
If objUser.Class = lcase("User") then
objGroup.add(objUser.ADsPath)
intCounter = intcounter +1
End If
Next
WScript.Echo strGroup & " has " & intCounter & " new members"

rgds
Babu

wrote in message

> is there an easy way that is script based to modify the group
> membership of everyone in an OU? i.e add all the users in the Customer
> Services OU to the customer services securtity group. I have a script
> that creates the user and adds an email address but I need to be able
> add the newusers to a group.
>
> Thanks
>
> J
>

 >> Stay informed about: group membership 
Back to top
Login to vote
codeye23

External


Since: Jul 26, 2006
Posts: 3



(Msg. 3) Posted: Thu Jul 27, 2006 2:54 am
Post subject: Re: group membership [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

It stops at this bit

> ' Prepare the OU and the Group
> Set objGroup = GetObject("LDAP://"& strGroup _
> & strOU & strDNSDomain)
> Set objOU =GetObject("LDAP://" & strOU & strDNSDomain)

saying that there is no object


Babu VT wrote:
> Hi,
>
> Check this out,
>
> ' GroupAddLots.vbs
> ' Sample VBScript to add users to a group.
> ' Author Guy Thomas
> ' Version 2.3 - May 2005
> ' ---------------------------------------------------------------'
> Option Explicit
> Dim objRootLDAP, objGroup, objUser, objOU
> Dim strOU, strGroup, strDNSDomain
> Dim intCounter
>
> ' Check these objects referenced by strOU, strGroup exist in strOU
> strOU = "OU=Newport,"
> strGroup = "CN=Coal Porters,"
>
> ' Bind to Active Directory and get LDAP name
> Set objRootLDAP = GetObject("LDAP://RootDSE")
> strDNSDomain = objRootLDAP.Get("DefaultNamingContext")
>
> ' Prepare the OU and the Group
> Set objGroup = GetObject("LDAP://"& strGroup _
> & strOU & strDNSDomain)
> Set objOU =GetObject("LDAP://" & strOU & strDNSDomain)
>
> ' On Error Resume next
> intCounter = 1
> For Each objUser In objOU
> If objUser.Class = lcase("User") then
> objGroup.add(objUser.ADsPath)
> intCounter = intcounter +1
> End If
> Next
> WScript.Echo strGroup & " has " & intCounter & " new members"
>
> rgds
> Babu
>
> wrote in message
>
> > is there an easy way that is script based to modify the group
> > membership of everyone in an OU? i.e add all the users in the Customer
> > Services OU to the customer services securtity group. I have a script
> > that creates the user and adds an email address but I need to be able
> > add the newusers to a group.
> >
> > Thanks
> >
> > J
> >
 >> Stay informed about: group membership 
Back to top
Login to vote
codeye23

External


Since: Jul 26, 2006
Posts: 3



(Msg. 4) Posted: Thu Jul 27, 2006 3:48 am
Post subject: Re: group membership [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

sorry for being thick but how do I do that. I'm not a scripter and very
new to this


Babu VT wrote:
> Hi,
>
> Check if strGroup strOU & strDNSDomain have values.
>
> You can just say,
> wscript.echo strOU
> strGroup
> strDNSDomain
>
> rgds
> Babu
> wrote in message
>
> > It stops at this bit
> >
> >> ' Prepare the OU and the Group
> >> Set objGroup = GetObject("LDAP://"& strGroup _
> >> & strOU & strDNSDomain)
> >> Set objOU =GetObject("LDAP://" & strOU & strDNSDomain)
> >
> > saying that there is no object
> >
> >
> > Babu VT wrote:
> >> Hi,
> >>
> >> Check this out,
> >>
> >> ' GroupAddLots.vbs
> >> ' Sample VBScript to add users to a group.
> >> ' Author Guy Thomas
> >> ' Version 2.3 - May 2005
> >> ' ---------------------------------------------------------------'
> >> Option Explicit
> >> Dim objRootLDAP, objGroup, objUser, objOU
> >> Dim strOU, strGroup, strDNSDomain
> >> Dim intCounter
> >>
> >> ' Check these objects referenced by strOU, strGroup exist in strOU
> >> strOU = "OU=Newport,"
> >> strGroup = "CN=Coal Porters,"
> >>
> >> ' Bind to Active Directory and get LDAP name
> >> Set objRootLDAP = GetObject("LDAP://RootDSE")
> >> strDNSDomain = objRootLDAP.Get("DefaultNamingContext")
> >>
> >> ' Prepare the OU and the Group
> >> Set objGroup = GetObject("LDAP://"& strGroup _
> >> & strOU & strDNSDomain)
> >> Set objOU =GetObject("LDAP://" & strOU & strDNSDomain)
> >>
> >> ' On Error Resume next
> >> intCounter = 1
> >> For Each objUser In objOU
> >> If objUser.Class = lcase("User") then
> >> objGroup.add(objUser.ADsPath)
> >> intCounter = intcounter +1
> >> End If
> >> Next
> >> WScript.Echo strGroup & " has " & intCounter & " new members"
> >>
> >> rgds
> >> Babu
> >>
> >> wrote in message
> >>
> >> > is there an easy way that is script based to modify the group
> >> > membership of everyone in an OU? i.e add all the users in the Customer
> >> > Services OU to the customer services securtity group. I have a script
> >> > that creates the user and adds an email address but I need to be able
> >> > add the newusers to a group.
> >> >
> >> > Thanks
> >> >
> >> > J
> >> >
> >
 >> Stay informed about: group membership 
Back to top
Login to vote
Babu VT

External


Since: Jul 25, 2006
Posts: 17



(Msg. 5) Posted: Thu Jul 27, 2006 7:55 am
Post subject: Re: group membership [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi,

Check if strGroup strOU & strDNSDomain have values.

You can just say,
wscript.echo strOU
strGroup
strDNSDomain

rgds
Babu
wrote in message

> It stops at this bit
>
>> ' Prepare the OU and the Group
>> Set objGroup = GetObject("LDAP://"& strGroup _
>> & strOU & strDNSDomain)
>> Set objOU =GetObject("LDAP://" & strOU & strDNSDomain)
>
> saying that there is no object
>
>
> Babu VT wrote:
>> Hi,
>>
>> Check this out,
>>
>> ' GroupAddLots.vbs
>> ' Sample VBScript to add users to a group.
>> ' Author Guy Thomas
>> ' Version 2.3 - May 2005
>> ' ---------------------------------------------------------------'
>> Option Explicit
>> Dim objRootLDAP, objGroup, objUser, objOU
>> Dim strOU, strGroup, strDNSDomain
>> Dim intCounter
>>
>> ' Check these objects referenced by strOU, strGroup exist in strOU
>> strOU = "OU=Newport,"
>> strGroup = "CN=Coal Porters,"
>>
>> ' Bind to Active Directory and get LDAP name
>> Set objRootLDAP = GetObject("LDAP://RootDSE")
>> strDNSDomain = objRootLDAP.Get("DefaultNamingContext")
>>
>> ' Prepare the OU and the Group
>> Set objGroup = GetObject("LDAP://"& strGroup _
>> & strOU & strDNSDomain)
>> Set objOU =GetObject("LDAP://" & strOU & strDNSDomain)
>>
>> ' On Error Resume next
>> intCounter = 1
>> For Each objUser In objOU
>> If objUser.Class = lcase("User") then
>> objGroup.add(objUser.ADsPath)
>> intCounter = intcounter +1
>> End If
>> Next
>> WScript.Echo strGroup & " has " & intCounter & " new members"
>>
>> rgds
>> Babu
>>
>> wrote in message
>>
>> > is there an easy way that is script based to modify the group
>> > membership of everyone in an OU? i.e add all the users in the Customer
>> > Services OU to the customer services securtity group. I have a script
>> > that creates the user and adds an email address but I need to be able
>> > add the newusers to a group.
>> >
>> > Thanks
>> >
>> > J
>> >
>
 >> Stay informed about: group membership 
Back to top
Login to vote
Babu VT

External


Since: Jul 25, 2006
Posts: 17



(Msg. 6) Posted: Thu Jul 27, 2006 9:55 am
Post subject: Re: group membership [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi,

Add the below lines after this one strDNSDomain =
objRootLDAP.Get("DefaultNamingContext")

wscript.echo strOU
wscript.echo strGroup
wscript.echo strDNSDomain

rgds
Babu
wrote in message

> sorry for being thick but how do I do that. I'm not a scripter and very
> new to this
>
>
> Babu VT wrote:
>> Hi,
>>
>> Check if strGroup strOU & strDNSDomain have values.
>>
>> You can just say,
>> wscript.echo strOU
>> strGroup
>> strDNSDomain
>>
>> rgds
>> Babu
>> wrote in message
>>
>> > It stops at this bit
>> >
>> >> ' Prepare the OU and the Group
>> >> Set objGroup = GetObject("LDAP://"& strGroup _
>> >> & strOU & strDNSDomain)
>> >> Set objOU =GetObject("LDAP://" & strOU & strDNSDomain)
>> >
>> > saying that there is no object
>> >
>> >
>> > Babu VT wrote:
>> >> Hi,
>> >>
>> >> Check this out,
>> >>
>> >> ' GroupAddLots.vbs
>> >> ' Sample VBScript to add users to a group.
>> >> ' Author Guy Thomas
>> >> ' Version 2.3 - May 2005
>> >> ' ---------------------------------------------------------------'
>> >> Option Explicit
>> >> Dim objRootLDAP, objGroup, objUser, objOU
>> >> Dim strOU, strGroup, strDNSDomain
>> >> Dim intCounter
>> >>
>> >> ' Check these objects referenced by strOU, strGroup exist in strOU
>> >> strOU = "OU=Newport,"
>> >> strGroup = "CN=Coal Porters,"
>> >>
>> >> ' Bind to Active Directory and get LDAP name
>> >> Set objRootLDAP = GetObject("LDAP://RootDSE")
>> >> strDNSDomain = objRootLDAP.Get("DefaultNamingContext")
>> >>
>> >> ' Prepare the OU and the Group
>> >> Set objGroup = GetObject("LDAP://"& strGroup _
>> >> & strOU & strDNSDomain)
>> >> Set objOU =GetObject("LDAP://" & strOU & strDNSDomain)
>> >>
>> >> ' On Error Resume next
>> >> intCounter = 1
>> >> For Each objUser In objOU
>> >> If objUser.Class = lcase("User") then
>> >> objGroup.add(objUser.ADsPath)
>> >> intCounter = intcounter +1
>> >> End If
>> >> Next
>> >> WScript.Echo strGroup & " has " & intCounter & " new members"
>> >>
>> >> rgds
>> >> Babu
>> >>
>> >> wrote in message
>> >>
>> >> > is there an easy way that is script based to modify the group
>> >> > membership of everyone in an OU? i.e add all the users in the
>> >> > Customer
>> >> > Services OU to the customer services securtity group. I have a
>> >> > script
>> >> > that creates the user and adds an email address but I need to be
>> >> > able
>> >> > add the newusers to a group.
>> >> >
>> >> > Thanks
>> >> >
>> >> > J
>> >> >
>> >
>
 >> Stay informed about: group membership 
Back to top
Login to vote
James

External


Since: Feb 15, 2005
Posts: 123



(Msg. 7) Posted: Sun Jul 30, 2006 11:55 pm
Post subject: Re: group membership [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

syntax : usrtogrp add.txt

where usrtogrp.exe is a resource kit from microsoft

sample: add.txt

domain: <your logon domain>
globalgroup: customer services securtity group
nt id 1
nt id 2

wrote in message

> is there an easy way that is script based to modify the group
> membership of everyone in an OU? i.e add all the users in the Customer
> Services OU to the customer services securtity group. I have a script
> that creates the user and adds an email address but I need to be able
> add the newusers to a group.
>
> Thanks
>
> J
>
 >> Stay informed about: group membership 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Determining Group Membership - Hello. What is the most convenient way to determine if a specified user is member of a specified group in a domain?

Group membership documentation - I'm looking for a vbscript that will go through AD and document each group / group membership in a specific OU. Ideally, this information would then be written to a text file. Has anyone come across such a script?

List Group Membership - Does Anyone know how to make this script output to atext file? Set Group = GetObject("WinNT://DOMAIN/GROUP") For Each Member in Group.Members wscript.echo Member.Name Next

List Group membership - Greetings- W2K3; single forest, single domain. Need to compile a list of all Groups AND Group Membersip in Domain... Is this possible? If so, how? Thanx OregonSteve

Group Membership TimeLine - Is there a way to figure out how long a user has been a member of a particular group in active directory? Thank you, bchad
   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 ]