No announcement yet.

Dsmod -addmbr failure when piping from Dsquery

  • Filter
  • Time
  • Show
Clear All
new posts

  • Dsmod -addmbr failure when piping from Dsquery

    The syntax is: "dsquery user "OU=testou,DC=domain,DC=Com" | dsmod group "CN=testing,OU=testou,DC=domain,DC=Com" -addmbr"

    The error is: "dsmod failed:CN=testing,OU=testou,DC=domain,DC=Com
    :The parameter is incorrect.
    type dsmod /? for help.

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

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

    Which still resulted in: failed:CN=Testing,OU=testou,DC=domain,DC=com
    :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=com" -addmbr "CN=Doe\, John,ou=testou,DC=domain,DC=com" works great.

    What gives, it just doesn't work when I use the pipe.

  • #2
    Re: Dsmod -addmbr failure when piping from Dsquery

    Have a look through this for help

    From that link your initial dsmod command should be this

    dsquery user "OU=testou,DC=domain,DC=Com" |dsmod group -addmbr "CN=testing,OU=testou,DC=domain,DC=Com"


    • #3
      Re: Dsmod -addmbr failure when piping from Dsquery

      Thanks for the reply. I tried with the revised syntax and am running into a different error.

      This command: dsquery user "OU=testou,DC=domain,DC=Com" | dsmod group -addmbr "CN=testing,OU=testou,DC=domain,DC=Com"

      results in: dsmod failed:CN=Doe\, John,OU=testou,DC=domain,DC=com:T
      he object class of the target does not match the one specified on the command li

      I don't understand, dsquery spits out DN's and dsmod should be accepting them. Just in case it matters, I'm positive that John Doe is a user and the group "Testing" is a security group.


      • #4
        Re: Dsmod -addmbr failure when piping from Dsquery

        dsquery user "DN" | dsmod group "DN" -addmbr is correct.


        • #5
          Re: Dsmod -addmbr failure when piping from Dsquery

          That's super, but it doesn't work. In my first post, the syntax I used was:

          dsquery user "OU=testou,DC=domain,DC=Com" | dsmod group "CN=testing,OU=testou,DC=domain,DC=Com" -addmbr

          which matches your suggestion. But I get an error:

          dsmod failed:cn=testing,ou=testou,dc=domain,dc=com:The parameter is incorrect.
          Last edited by mhashemi; 12th August 2008, 21:12. Reason: fixed line break.


          • #6
            Re: Dsmod -addmbr failure when piping from Dsquery

            from technet:
            dsquery user OU=Marketing,DC=Contoso,DC=Com | dsmod group  "CN=Marketing Staff,OU=Marketing,DC=Contoso,DC=Com" -addmbr

            Watch careful for quotes and so.
            Technical Consultant

            MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
            "No matter how secure, there is always the human factor."

            "Enjoy life today, tomorrow may never come."
            "If you're going through hell, keep going. ~Winston Churchill"


            • #7
              Re: Dsmod -addmbr failure when piping from Dsquery

              I read that page and am quite certain I am typing the command correctly. I simply copy/pasted it into my command line and modified the DN to match my path.

              I have written quotes around the both the OU DN and the group DN. I have also excluded the quotes completely (which should be fine because there are no spaces in those DNs).

              It doesn't matter if I copy/paste from a text file or type the command directly into the command prompt.

              Could AD be broken or something? Why wouldn't this work?


              • #8
                Re: Dsmod -addmbr failure when piping from Dsquery

                Are you running this at a client or on a DC?


                • #9
                  Re: Dsmod -addmbr failure when piping from Dsquery

                  Could it be that dsquery found some kind of 'ghost' users? Because, dsmod return this exact error message on an empty ( "" ) addmbr parameter.
                  Originally posted by mhashemi View Post
                  DSQUERY USER -startnode "OU=testou,DC=domain,DC=com">"c:\test.txt"
                  Check the content of c:\test.txt for lines just containing quotes or other signs. And for lines that show quote(s) within the quoted dn's.

                  Is there perhaps a differnce in output when using this query (?):
                  DSQUERY USER -limit 0 -scope onelevel -gc -r -startnode "OU=testou,DC=domain,DC=com">"c:\test2.txt"
                  Last edited by Rems; 13th August 2008, 16:33. Reason: fixed line wrap

                  This posting is provided "AS IS" with no warranties, and confers no rights.


                  ** Remember to give credit where credit's due **
                  and leave Reputation Points for meaningful posts


                  • #10
                    Re: Dsmod -addmbr failure when piping from Dsquery

                    Brilliant! Running it from the DC (which I had not tried) worked fine.

                    The question remains though, why can I run the dsquery and dsmod individually from my machine, but cannot run them together?