Overclockers Australia Forums

OCAU News - Wiki - QuickLinks - Pix - Sponsors  

Go Back   Overclockers Australia Forums > Software Topics > Windows Operating Systems

Notices


Sign up for a free OCAU account and this ad will go away!
Search our forums with Google:
Reply
 
Thread Tools
Old 14th August 2012, 11:29 AM   #1
UserInterface Thread Starter
Member
 
Join Date: Jan 2011
Posts: 234
Default Help with DSmod (copy group members)

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
Source from here

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..
UserInterface is offline   Reply With Quote

Join OCAU to remove this ad!
Old 14th August 2012, 11:37 AM   #2
UserInterface Thread Starter
Member
 
Join Date: Jan 2011
Posts: 234
Default

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
and I get this error "The specified account name is already a member of the local group"
UserInterface is offline   Reply With Quote
Old 14th August 2012, 2:02 PM   #3
bsbozzy
Member
 
bsbozzy's Avatar
 
Join Date: Nov 2003
Location: Sydney
Posts: 3,551
Default

Quote:
Originally Posted by UserInterface View Post
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
and I get this error "The specified account name is already a member of the local group"
When you pipe output from from one ds to the other it is going to be for the dn that is to be modified, not the dn that is to be added to an existing one if that makes sense.

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.
bsbozzy is offline   Reply With Quote
Old 14th August 2012, 2:50 PM   #4
UserInterface Thread Starter
Member
 
Join Date: Jan 2011
Posts: 234
Default

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?
UserInterface is offline   Reply With Quote
Old 14th August 2012, 3:04 PM   #5
bsbozzy
Member
 
bsbozzy's Avatar
 
Join Date: Nov 2003
Location: Sydney
Posts: 3,551
Default

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.
bsbozzy is offline   Reply With Quote
Old 14th August 2012, 4:04 PM   #6
UserInterface Thread Starter
Member
 
Join Date: Jan 2011
Posts: 234
Default

Quote:
Originally Posted by bsbozzy View Post
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=..."


Bit slow but I get it now.

Thanks!
UserInterface is offline   Reply With Quote
Old 14th August 2012, 5:06 PM   #7
Matt_NZ
Member
 
Matt_NZ's Avatar
 
Join Date: Aug 2002
Location: Christchurch, New Zealand
Posts: 3,264
Default

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)
Matt_NZ is offline   Reply With Quote
Old 14th August 2012, 11:06 PM   #8
looktall
Working Class Hero
 
looktall's Avatar
 
Join Date: Sep 2001
Location: morley.wa.au
Posts: 18,002
Default

Quote:
Originally Posted by Matt_NZ View Post
Just to be "that guy", I'd recommend switching over to Powershell
you can't say that and then not show how it would be done in powershell.

feel free to show us.
__________________
JoJoker endorses this product and/or comment.
looktall is offline   Reply With Quote
Reply

Bookmarks

Sign up for a free OCAU account and this ad will go away!

Thread Tools

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

Forum Jump


All times are GMT +10. The time now is 8:03 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. -
OCAU is not responsible for the content of individual messages posted by others.
Other content copyright Overclockers Australia.
OCAU is hosted by Internode!