Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Active Directory > copying users form one group to a new group

Reply
Thread Tools Display Modes

copying users form one group to a new group

 
 
Johan deheugden
Guest
Posts: n/a

 
      10-28-2009
Is it possible to copy(not move) users from one group to a different group
through a script? am creating some new sites in AD and i dont want to do the
copying by hand. I did find the following script(heyscriptingguy):
Const ADS_GROUP_TYPE_GLOBAL_GROUP = &H2

Set objOU = GetObject("LDAP://OU=Finance, dc=fabrikam, dc=com")
Set objOldGroup = GetObject("LDAP://CN=Finance Managers, ou=Finance,
dc=fabrikam, dc=com")

Set objNewGroup = objOU.Create("Group", "Finance Department")
objNewGroup.sAMAccountName = "financedept"
objNewGroup.groupType = ADS_GROUP_TYPE_GLOBAL_GROUP
objNewGroup.Set Info

For Each objUser in objOldGroup.Member
objNewGroup.Add "LDAP://" & objUser
Next

but that script is moving from 1 group to a group thats also being created.
My destinationgroups already exist
 
Reply With Quote
 
 
 
 
Meinolf Weber [MVP-DS]
Guest
Posts: n/a

 
      10-28-2009
Hello Johan,

Check out Marcins answer:
----------------------------------------------------------------------
Is this what you are looking for?

Set oGroup1 =
GetObject("LDAP://cn=Group1,ou=Groups,dc=change-my-name,dc=local")
Set oGroup2 =
GetObject("LDAP://cn=Group2,ou=Groups,dc=change-my-name,dc=local")

For Each oUser in oGroup1.Members
oGroup2.Add(oUser.ADsPath)
Next

hth
Marcin
----------------------------------------------------------------------
From:
http://forums.techarena.in/active-directory/900625.htm

Best regards

Meinolf Weber
Disclaimer: This posting is provided "AS IS" with no warranties, and confers
no rights.
** Please do NOT email, only reply to Newsgroups
** HELP us help YOU!!! http://www.blakjak.demon.co.uk/mul_crss.htm


> Is it possible to copy(not move) users from one group to a different
> group
> through a script? am creating some new sites in AD and i dont want to
> do the
> copying by hand. I did find the following script(heyscriptingguy):
> Const ADS_GROUP_TYPE_GLOBAL_GROUP = &H2
> Set objOU = GetObject("LDAP://OU=Finance, dc=fabrikam, dc=com")
> Set objOldGroup = GetObject("LDAP://CN=Finance Managers, ou=Finance,
> dc=fabrikam, dc=com")
> Set objNewGroup = objOU.Create("Group", "Finance Department")
> objNewGroup.sAMAccountName = "financedept" objNewGroup.groupType =
> ADS_GROUP_TYPE_GLOBAL_GROUP objNewGroup.Set Info
>
> For Each objUser in objOldGroup.Member
> objNewGroup.Add "LDAP://" & objUser
> Next
> but that script is moving from 1 group to a group thats also being
> created. My destinationgroups already exist
>



 
Reply With Quote
 
Johan deheugden
Guest
Posts: n/a

 
      10-28-2009
indeed. thats it. didnt find it.
tha

"Meinolf Weber [MVP-DS]" wrote:

> Hello Johan,
> nks for the reply
> Check out Marcins answer:
> ----------------------------------------------------------------------
> Is this what you are looking for?
>
> Set oGroup1 =
> GetObject("LDAP://cn=Group1,ou=Groups,dc=change-my-name,dc=local")
> Set oGroup2 =
> GetObject("LDAP://cn=Group2,ou=Groups,dc=change-my-name,dc=local")
>
> For Each oUser in oGroup1.Members
> oGroup2.Add(oUser.ADsPath)
> Next
>
> hth
> Marcin
> ----------------------------------------------------------------------
> From:
> http://forums.techarena.in/active-directory/900625.htm
>
> Best regards
>
> Meinolf Weber
> Disclaimer: This posting is provided "AS IS" with no warranties, and confers
> no rights.
> ** Please do NOT email, only reply to Newsgroups
> ** HELP us help YOU!!! http://www.blakjak.demon.co.uk/mul_crss.htm
>
>
> > Is it possible to copy(not move) users from one group to a different
> > group
> > through a script? am creating some new sites in AD and i dont want to
> > do the
> > copying by hand. I did find the following script(heyscriptingguy):
> > Const ADS_GROUP_TYPE_GLOBAL_GROUP = &H2
> > Set objOU = GetObject("LDAP://OU=Finance, dc=fabrikam, dc=com")
> > Set objOldGroup = GetObject("LDAP://CN=Finance Managers, ou=Finance,
> > dc=fabrikam, dc=com")
> > Set objNewGroup = objOU.Create("Group", "Finance Department")
> > objNewGroup.sAMAccountName = "financedept" objNewGroup.groupType =
> > ADS_GROUP_TYPE_GLOBAL_GROUP objNewGroup.Set Info
> >
> > For Each objUser in objOldGroup.Member
> > objNewGroup.Add "LDAP://" & objUser
> > Next
> > but that script is moving from 1 group to a group thats also being
> > created. My destinationgroups already exist
> >

>
>
> .
>

 
Reply With Quote
 
Johan deheugden
Guest
Posts: n/a

 
      10-28-2009
thats it. thanks for the reply, youre saving me hours of work .
 
Reply With Quote
 
Meinolf Weber [MVP-DS]
Guest
Posts: n/a

 
      10-28-2009
Hello Johan,

You're welcome.

Best regards

Meinolf Weber
Disclaimer: This posting is provided "AS IS" with no warranties, and confers
no rights.
** Please do NOT email, only reply to Newsgroups
** HELP us help YOU!!! http://www.blakjak.demon.co.uk/mul_crss.htm


> thats it. thanks for the reply, youre saving me hours of work .
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User Accounts can't be set to Administrator Steve A. Windows Vista Administration 10 03-09-2008 06:35 AM
Enable Power Users group in Vista? abbphan Windows Vista Administration 0 11-13-2007 04:42 PM
Users group can't run attrib.exe or subst.exe Keith Hill [MVP] Windows Vista Administration 2 09-28-2007 05:14 PM
Standard Users Privileges Sam Windows Vista Administration 15 07-06-2007 07:22 PM
How to change 'Group' permissions on existing folder? Jason Windows Vista File Management 4 05-24-2007 02:43 AM



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 47 48 49 50 51 52 53 54 55 56 57 58 59