Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Add All User's in one OU to a group located in another OU

Reply
 
Old 11-12-2008   #1 (permalink)
gbrown135


 
 

Add All User's in one OU to a group located in another OU

HI

Is theer any script at all to add all user's in one OU to a particular
group. This group is located in another OU.

Help Appreciated

Gary

My System SpecsSystem Spec
Old 11-12-2008   #2 (permalink)
Richard Mueller [MVP]


 
 

Re: Add All User's in one OU to a group located in another OU

Gary wrote:
Quote:

> HI
>
> Is theer any script at all to add all user's in one OU to a particular
> group. This group is located in another OU.
>
> Help Appreciated
You need the Distinguished Names of the OU and the group. The code would be
similar to:
==========
' Bind to OU object using Distinguished Name.
Set objOU = GetObject("LDAP://ou=West,dc=MyDomain,dc=com")

' Bind to group object using Distinguished Name.
Set objGroup = GetObject("LDAP://cn=Test Group,ou=East,dc=MyDomain,dc=com")

' Filter on user objects in OU.
objOU.Filter = Array("user")

' Enumerate users in OU.
For Each objUser In objGroup
' Check if user already a member of the group.
If (objGroup.IsMember(objUser.AdsPath) = False) Then
' Add user to the group.
objGroup.Add(objUser.AdsPath)
End If
Next

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


My System SpecsSystem Spec
Old 11-13-2008   #3 (permalink)
Wiseman82


 
 

Re: Add All User's in one OU to a group located in another OU

It's easy to do this using the Bulk Modify app from my website:

http://www.wisesoft.co.uk/Products/P...ol/BulkModify/

Just query for all the users in that OU and append the group using the Bulk
Modify dialog.

Hope this helps,

David
http://www.wisesoft.co.uk
(My personal website and a free resource for IT Professionals)

"gbrown135" <gbrown135@xxxxxx> wrote in message
news:1EE89EC7-DA83-41F1-9953-FCA377FDC619@xxxxxx
Quote:

> HI
>
> Is theer any script at all to add all user's in one OU to a particular
> group. This group is located in another OU.
>
> Help Appreciated
>
> Gary
My System SpecsSystem Spec
Old 11-14-2008   #4 (permalink)
Tim Munro


 
 

Re: Add All User's in one OU to a group located in another OU

If you like command line stuff try this:

dsquery user "<DN of source OU>" | dsmod group "<dn of group>" -addmbr

--
Tim

"Wiseman82" <nospam@xxxxxx> wrote in message
news:CD73F199-E2C3-467A-9FCF-2245C427FAEC@xxxxxx
Quote:

> It's easy to do this using the Bulk Modify app from my website:
>
> http://www.wisesoft.co.uk/Products/P...ol/BulkModify/
>
> Just query for all the users in that OU and append the group using the
> Bulk Modify dialog.
>
> Hope this helps,
>
> David
> http://www.wisesoft.co.uk
> (My personal website and a free resource for IT Professionals)
>
> "gbrown135" <gbrown135@xxxxxx> wrote in message
> news:1EE89EC7-DA83-41F1-9953-FCA377FDC619@xxxxxx
Quote:

>> HI
>>
>> Is theer any script at all to add all user's in one OU to a particular
>> group. This group is located in another OU.
>>
>> Help Appreciated
>>
>> Gary
>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
add user to group /group scope - Global /Group type - Security PowerShell
Re: Enumerate User's AD Group Membership VB Script
Re: Enumerate User's AD Group Membership VB Script
Changing the user's 'name' Vista General
Posting with another user's name Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46