Dsmod -addmbr failure when piping from Dsquery

By mhashemi ·
The syntax is: "dsquery user "OU=ouName,DC=companyName,DC=Com" | dsmod group "CN=groupName,OU=ouNmae,DC=companyName,DC=Com" -addmbr"

The error is: "dsmod failed:CN=groupName,OU=ouName,DC=companyName,DC=Com
:The parameter is incorrect.
type dsmod /? for help."

If I run the dsquery portion, it returns a list of DN's. If I take one of those DN's and stick it to the end of the dsmod portion, that user is added successfully. I just can't pipe the two together. Thoughts?

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

The syntax is correct

by Bizzo In reply to Dsmod -addmbr failure whe ...

The only thing I can think of is that maybe you've done it correctly here in your post, but not when you're doing it for real?

Sorry not to be of much help.

Collapse -

Pipe the output to a text file [edit2]

by Dumphrey In reply to Dsmod -addmbr failure whe ...

and compare that to the expected input syntax of dsmod..

This seems to work:

dsquery user -name joh* | dsmod group "CN=Testing,CN=Users,DC=domain,DC=local" -addmbr

It finds all users with DN matching joh* and adds them to the Testing group.
I got the group DN from a dsquery group command and sent it to a text file to avoid spelling mistakes...
Looks to pretty much be exactly what you started with.

List all users in an OU/container (users container in my example) and add them to the Testing group in the TestOU OU of domaine.local...

DSQUERY USER -startnode CN=Users,DC=domain,DC=local | DSMOD group "CN=Testing,OU=testou,DC=domaine,DC=local" -addmbr

Collapse -

Output is DN's

by mhashemi In reply to Pipe the output to a text ...

Doing this: DSQUERY USER -startnode CN=Users,DC=domain,DC=local > c:\test.txt results in a list of DN's such as:"CN=Doe\, John,CN=Users,DC=domain,DC=local"

So I did this: DSMOD group "CN=Testing,OU=testou,DC=domain,DC=local" -addmbr < c:\test.txt which resulted in "dsmod failed:CN=Testing,OU=testou,DC=domain,DC=local
:The parameter is incorrect."

So I opened up the test.txt file and copied out a DN. Doing this: DSMOD group "CN=Testing,OU=testou,DC=domain,DC=local" -addmbr "CN=Doe\, John,CN=Users,DC=domain,DC=local" works great.

What gives?

Collapse -

Here is the solution

by mhashemi In reply to Output is DN's

The answer it from the DC. The synatx is:

DSQUERY USER -startnode CN=Users,DC=domain,DC=local | DSMOD group "CN=Testing,OU=testou,DC=domain,DC=local" -addmbr

I don't understand though why I can run the individual parts from my machine, but can't run the piped command.

Back to Software Forum
4 total posts (Page 1 of 1)  

Related Discussions

Related Forums