![]() |
![]() OCAU News - Wiki - QuickLinks - Pix - Sponsors |
|
|||||||
| Notices |
|
Sign up for a free OCAU account and this ad will go away! Search our forums with Google: |
![]() |
|
|
Thread Tools |
|
|
#1 |
|
Member
Join Date: Jan 2011
Posts: 234
|
I am trying to copy all members in a DISTgroup to a new DISTgroup.
Every time I try it though I get a syntax error or the error below. I need to move the members as I have to delete the old group so it is no good just adding the old group as a nested group. I was trying this Code:
dsquery user "FromDN" | dsmod group "ToDN" -addmbr I keep getting The specified account name is already a member of the local group, but I just want it to continue if there are duplicates.. Hope this makes sense.. |
|
|
|
| Join OCAU to remove this ad! |
|
|
#2 |
|
Member
Join Date: Jan 2011
Posts: 234
|
My bad I was trying this one
Code:
dsget group "CN=US INFO,OU=Distribution Lists,DC=contoso,DC=com" -members | dsmod group "CN=CANADA INFO,OU=Distribution Lists,DC= contoso,DC=com" -addmbr |
|
|
|
|
|
#3 | |
|
Member
Join Date: Nov 2003
Location: Sydney
Posts: 3,551
|
Quote:
I would use something like: for /f "tokens=1 delims=]" %a in ('dsget group "CN=US INFO,OU=Distribution Lists,DC=contoso,DC=com" -members ') do dsmod group "CN=CANADA INFO,OU=Distribution Lists,DC= contoso,DC=com" -addmbr %a
__________________
WTB: Any one have a VT SS Commodore die cast model in heron white? Please PM Me. |
|
|
|
|
|
|
#4 |
|
Member
Join Date: Jan 2011
Posts: 234
|
I used the option that you gave but I would still like to understand why the first one didn't work.
I'm still not sure what you are saying (assuming that it is DN instead of DS). Are you saying that I had my DN's backwards and I should have the group I am copying into first and the group i'm copying from last? |
|
|
|
|
|
#5 |
|
Member
Join Date: Nov 2003
Location: Sydney
Posts: 3,551
|
when you run a ds_ command it outputs some data. When you pipe it to another ds_ command, it will always be for the DN that is to be modified, e.g. dsmod group ///OUTPUT GOES HERE/// -addmbr "cn=..."
__________________
WTB: Any one have a VT SS Commodore die cast model in heron white? Please PM Me. |
|
|
|
|
|
#6 |
|
Member
Join Date: Jan 2011
Posts: 234
|
|
|
|
|
|
|
#7 |
|
Member
Join Date: Aug 2002
Location: Christchurch, New Zealand
Posts: 3,264
|
Just to be "that guy", I'd recommend switching over to Powershell
__________________
ASUS P6T SE ~ Intel i7 930 ~ Gigabyte 9800GTS ~ 6gb DDR3 RAM ~ 500gb SATA Seagate HDD ~ LiteScribe ASUS DVD-RW ~ Windows 7 Ultimate x64 Currently addicted to: Star Wars Galaxies (Obraik on Chilastra) |
|
|
|
|
|
#8 | |
|
Working Class Hero
Join Date: Sep 2001
Location: morley.wa.au
Posts: 18,002
|
Quote:
feel free to show us.
__________________
JoJoker endorses this product and/or comment. |
|
|
|
|
![]() |
| Bookmarks |
|
Sign up for a free OCAU account and this ad will go away! |
| Thread Tools | |
|
|