DSMOD Group adds

MikeK

Distinguished
Aug 28, 2004
20
0
18,510
Archived from groups: microsoft.public.win2000.active_directory (More info?)

I am trying to add/remove users to/from a group using DSMOD Group.
I've been able to pipe a user samid name to disbable an account by
using DSQUERY User -samid and piping it to DSMOD User.

I'm having trouble adding/removing a user piping the samid to DSMOD
Group.

I'd appreciate any help in parsing this. The MS examples (that I can
find) with group adds don't address this. If I'm posting to the wrong
newsgroup, what is a more appropriate group to post this.

Thank you very much

---Mike
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.active_directory (More info?)

You will probably want to show the command you are trying. And the resulting
error if any.

joe

--
Joe Richards Microsoft MVP Windows Server Directory Services
www.joeware.net


MikeK wrote:
> I am trying to add/remove users to/from a group using DSMOD Group.
> I've been able to pipe a user samid name to disbable an account by
> using DSQUERY User -samid and piping it to DSMOD User.
>
> I'm having trouble adding/removing a user piping the samid to DSMOD
> Group.
>
> I'd appreciate any help in parsing this. The MS examples (that I can
> find) with group adds don't address this. If I'm posting to the wrong
> newsgroup, what is a more appropriate group to post this.
>
> Thank you very much
>
> ---Mike
 

MikeK

Distinguished
Aug 28, 2004
20
0
18,510
Archived from groups: microsoft.public.win2000.active_directory (More info?)

This is the code that fails:

dsquery User -samid logonname | dsmod Group
"CN=Groupname,CN=Builtin,DC=Domainname,DC=Com" -addmbr
"CN=logonname,CN=Users,DC=Spozinch,DC=Com"

The error I get says it can't find user. Thanks

---Mike


On Sat, 04 Dec 2004 12:25:35 -0500, "Joe Richards [MVP]"
<humorexpress@hotmail.com> wrote:

>You will probably want to show the command you are trying. And the resulting
>error if any.
>
> joe
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.active_directory (More info?)

circa Sat, 04 Dec 2004 21:38:02 GMT, in
microsoft.public.win2000.active_directory, MikeK
(mkallan@remthiscomcast.net) said,
> This is the code that fails:
>
> dsquery User -samid logonname | dsmod Group
> "CN=Groupname,CN=Builtin,DC=Domainname,DC=Com" -addmbr
> "CN=logonname,CN=Users,DC=Spozinch,DC=Com"
>
> The error I get says it can't find user. Thanks
>
>
What is the line "CN=<logonname>,CN=Users,DC=Spozinch,DC=com"
supposed to do? By piping the results of the dsquery, you are
providing the DN of the user to add to the group.

Try this instead:

dsquery user -samid <logonname>|dsmod group "CN=
<groupname>,CN=Builtin,DC=<domainprefix>,DC=<domainsuffix>

For example, if I have a user whose logon name is jblow and I want to
add jblow to the Account Operators group in domain.dom, this does it:

dsquery user -samid jblow|dsmod group "CN=Account
Operators,CN=Builtin,DC=domain,DC=dom"

HTH,

Laura
--
Experience is the name every one gives to their mistakes.
-Oscar Wilde
 

MikeK

Distinguished
Aug 28, 2004
20
0
18,510
Archived from groups: microsoft.public.win2000.active_directory (More info?)

Sorry I pasted the third line by mistake.

If I use:

dsmod group "CN=HighSec,CN=Builtin,DC=Spozinch,DC=Com" -addmbr
"CN=ROSS JONES,CN=Users,DC=Spozinch,DC=Com"

it succeeds. This of course has the UPN full name, Ross Jones.

When I try the code you suggest

Dsquery User -samid ross | dsmod group
"CN=HighSec,CN=Builtin,DC=Spozinch,DC=Com" -addmbr

it fails with the errors: Dsmod failed: you must specify at least one
parameter to modify. Dsquery failed: the parameter is incorrect.:
Incorrect object type specified.

I've used:
dsquery -samid ross | dsuser user -disabled yes

and that succeeds. I mention this only to suggest that I'm using
valid params but I must be parsing them incorrectly.


On Sun, 5 Dec 2004 18:16:11 -0500, "Laura A. Robinson"
<geekwench@snippit.hotmail.com> wrote:

>circa Sat, 04 Dec 2004 21:38:02 GMT, in
>microsoft.public.win2000.active_directory, MikeK
>(mkallan@remthiscomcast.net) said,
>> This is the code that fails:
>>
>> dsquery User -samid logonname | dsmod Group
>> "CN=Groupname,CN=Builtin,DC=Domainname,DC=Com" -addmbr
>> "CN=logonname,CN=Users,DC=Spozinch,DC=Com"
>>
>> The error I get says it can't find user. Thanks
>>
>>
>What is the line "CN=<logonname>,CN=Users,DC=Spozinch,DC=com"
>supposed to do? By piping the results of the dsquery, you are
>providing the DN of the user to add to the group.
>
>Try this instead:
>
>dsquery user -samid <logonname>|dsmod group "CN=
><groupname>,CN=Builtin,DC=<domainprefix>,DC=<domainsuffix>
>
>For example, if I have a user whose logon name is jblow and I want to
>add jblow to the Account Operators group in domain.dom, this does it:
>
>dsquery user -samid jblow|dsmod group "CN=Account
>Operators,CN=Builtin,DC=domain,DC=dom"
>
>HTH,
>
>Laura
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.active_directory (More info?)

circa Mon, 06 Dec 2004 01:22:50 GMT, in
microsoft.public.win2000.active_directory, MikeK
(mkallan@remthiscomcast.net) said,
> Sorry I pasted the third line by mistake.
>
> If I use:
>
> dsmod group "CN=HighSec,CN=Builtin,DC=Spozinch,DC=Com" -addmbr
> "CN=ROSS JONES,CN=Users,DC=Spozinch,DC=Com"
>
> it succeeds. This of course has the UPN full name, Ross Jones.
>
> When I try the code you suggest
>
> Dsquery User -samid ross | dsmod group
> "CN=HighSec,CN=Builtin,DC=Spozinch,DC=Com" -addmbr
>
> it fails with the errors: Dsmod failed: you must specify at least one
> parameter to modify. Dsquery failed: the parameter is incorrect.:
> Incorrect object type specified.
>
> I've used:
> dsquery -samid ross | dsuser user -disabled yes
>
> and that succeeds. I mention this only to suggest that I'm using
> valid params but I must be parsing them incorrectly.
>

Okay, what happens if you just type "dsquery user -samid ross"
(without the quotes, of course)?

Laura
--
Experience is the name every one gives to their mistakes.
-Oscar Wilde
 

MikeK

Distinguished
Aug 28, 2004
20
0
18,510
Archived from groups: microsoft.public.win2000.active_directory (More info?)

dsquery User -samid ross

fails error: "The parameter is incorrect. Incorrect object type
specfied."

However:

dsquery User -samid ross | dsget User -disabled -fn -ln

succeeds, giving me the disabled status along with first and last
name. I think dsquery has to be coupled (piped) to another command in
order to work.

On Sun, 5 Dec 2004 22:15:09 -0500, "Laura A. Robinson"
<geekwench@snippit.hotmail.com> wrote:

>circa Mon, 06 Dec 2004 01:22:50 GMT, in
>microsoft.public.win2000.active_directory, MikeK
>(mkallan@remthiscomcast.net) said,
>> Sorry I pasted the third line by mistake.
>>
>> If I use:
>>
>> dsmod group "CN=HighSec,CN=Builtin,DC=Spozinch,DC=Com" -addmbr
>> "CN=ROSS JONES,CN=Users,DC=Spozinch,DC=Com"
>>
>> it succeeds. This of course has the UPN full name, Ross Jones.
>>
>> When I try the code you suggest
>>
>> Dsquery User -samid ross | dsmod group
>> "CN=HighSec,CN=Builtin,DC=Spozinch,DC=Com" -addmbr
>>
>> it fails with the errors: Dsmod failed: you must specify at least one
>> parameter to modify. Dsquery failed: the parameter is incorrect.:
>> Incorrect object type specified.
>>
>> I've used:
>> dsquery -samid ross | dsuser user -disabled yes
>>
>> and that succeeds. I mention this only to suggest that I'm using
>> valid params but I must be parsing them incorrectly.
>>
>
>Okay, what happens if you just type "dsquery user -samid ross"
>(without the quotes, of course)?
>
>Laura
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.active_directory (More info?)

dsquery User -samid ross
should not fail.
It should return the quoted distinguishedName of Ross.



On Mon, 06 Dec 2004 03:57:41 GMT, MikeK <mkallan@remthiscomcast.net> wrote:

>dsquery User -samid ross
>
>fails error: "The parameter is incorrect. Incorrect object type
>specfied."
>
>However:
>
>dsquery User -samid ross | dsget User -disabled -fn -ln
>
>succeeds, giving me the disabled status along with first and last
>name. I think dsquery has to be coupled (piped) to another command in
>order to work.
>
>On Sun, 5 Dec 2004 22:15:09 -0500, "Laura A. Robinson"
><geekwench@snippit.hotmail.com> wrote:
>
>>circa Mon, 06 Dec 2004 01:22:50 GMT, in
>>microsoft.public.win2000.active_directory, MikeK
>>(mkallan@remthiscomcast.net) said,
>>> Sorry I pasted the third line by mistake.
>>>
>>> If I use:
>>>
>>> dsmod group "CN=HighSec,CN=Builtin,DC=Spozinch,DC=Com" -addmbr
>>> "CN=ROSS JONES,CN=Users,DC=Spozinch,DC=Com"
>>>
>>> it succeeds. This of course has the UPN full name, Ross Jones.
>>>
>>> When I try the code you suggest
>>>
>>> Dsquery User -samid ross | dsmod group
>>> "CN=HighSec,CN=Builtin,DC=Spozinch,DC=Com" -addmbr
>>>
>>> it fails with the errors: Dsmod failed: you must specify at least one
>>> parameter to modify. Dsquery failed: the parameter is incorrect.:
>>> Incorrect object type specified.
>>>
>>> I've used:
>>> dsquery -samid ross | dsuser user -disabled yes
>>>
>>> and that succeeds. I mention this only to suggest that I'm using
>>> valid params but I must be parsing them incorrectly.
>>>
>>
>>Okay, what happens if you just type "dsquery user -samid ross"
>>(without the quotes, of course)?
>>
>>Laura


Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
 

MikeK

Distinguished
Aug 28, 2004
20
0
18,510
Archived from groups: microsoft.public.win2000.active_directory (More info?)

Thank you.
I know the DSQUERY doesn't fail, What I need to know is how to pipe
the result from DSQUERY to DSMOD Group to add a member.

I was trying to show that I was successful making other changes. The
sad history if the thread is below.


On Mon, 06 Dec 2004 07:56:31 -0500, Jerold Schulman <Jerry@jsiinc.com>
wrote:

>
>dsquery User -samid ross
>should not fail.
>It should return the quoted distinguishedName of Ross.
>
>
>
>On Mon, 06 Dec 2004 03:57:41 GMT, MikeK <mkallan@remthiscomcast.net> wrote:
>
>>dsquery User -samid ross
>>
>>fails error: "The parameter is incorrect. Incorrect object type
>>specfied."
>>
>>However:
>>
>>dsquery User -samid ross | dsget User -disabled -fn -ln
>>
>>succeeds, giving me the disabled status along with first and last
>>name. I think dsquery has to be coupled (piped) to another command in
>>order to work.
>>
>>On Sun, 5 Dec 2004 22:15:09 -0500, "Laura A. Robinson"
>><geekwench@snippit.hotmail.com> wrote:
>>
>>>circa Mon, 06 Dec 2004 01:22:50 GMT, in
>>>microsoft.public.win2000.active_directory, MikeK
>>>(mkallan@remthiscomcast.net) said,
>>>> Sorry I pasted the third line by mistake.
>>>>
>>>> If I use:
>>>>
>>>> dsmod group "CN=HighSec,CN=Builtin,DC=Spozinch,DC=Com" -addmbr
>>>> "CN=ROSS JONES,CN=Users,DC=Spozinch,DC=Com"
>>>>
>>>> it succeeds. This of course has the UPN full name, Ross Jones.
>>>>
>>>> When I try the code you suggest
>>>>
>>>> Dsquery User -samid ross | dsmod group
>>>> "CN=HighSec,CN=Builtin,DC=Spozinch,DC=Com" -addmbr
>>>>
>>>> it fails with the errors: Dsmod failed: you must specify at least one
>>>> parameter to modify. Dsquery failed: the parameter is incorrect.:
>>>> Incorrect object type specified.
>>>>
>>>> I've used:
>>>> dsquery -samid ross | dsuser user -disabled yes
>>>>
>>>> and that succeeds. I mention this only to suggest that I'm using
>>>> valid params but I must be parsing them incorrectly.
>>>>
>>>
>>>Okay, what happens if you just type "dsquery user -samid ross"
>>>(without the quotes, of course)?
>>>
>>>Laura
>
>
>Jerold Schulman
>Windows Server MVP
>JSI, Inc.
>http://www.jsiinc.com
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.active_directory (More info?)

circa Mon, 06 Dec 2004 03:57:41 GMT, in
microsoft.public.win2000.active_directory, MikeK
(mkallan@remthiscomcast.net) said,
> succeeds, giving me the disabled status along with first and last
> name. I think dsquery has to be coupled (piped) to another command in
> order to work.
>
Nope; it works fine for me without piping, which is why I asked. :)

Laura
--
Experience is the name every one gives to their mistakes.
-Oscar Wilde
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.active_directory (More info?)

circa Mon, 06 Dec 2004 14:31:00 GMT, in
microsoft.public.win2000.active_directory, MikeK
(mkallan@remthiscomcast.net) said,
>
> Thank you.
> I know the DSQUERY doesn't fail,

But it does- Jerold is right- you should get a DN as a result of a
straight dsquery user command.

> What I need to know is how to pipe
> the result from DSQUERY to DSMOD Group to add a member.

Until we figure out why your dsquery isn't working (and it isn't),
that's not really likely to be possible. :)
>
> I was trying to show that I was successful making other changes. The
> sad history if the thread is below.

Understood, but see the other replies- you *should* get a DN when you
run dsquery user -samid ross. Something is wrong here. What happens
if you try it with a different account?

Laura
>
>

--
Experience is the name every one gives to their mistakes.
-Oscar Wilde
 

MikeK

Distinguished
Aug 28, 2004
20
0
18,510
Archived from groups: microsoft.public.win2000.active_directory (More info?)

You were right. I changed the user and it worked perfectly. I'm
embarrassed that I didn't think of it.

I really appreciate everyone's help and that you people stuck by me on
this rather simple question.

---Mike
On Tue, 7 Dec 2004 23:45:24 -0500, "Laura A. Robinson"
<geekwench@snippit.hotmail.com> wrote:

>circa Mon, 06 Dec 2004 14:31:00 GMT, in
>microsoft.public.win2000.active_directory, MikeK
>(mkallan@remthiscomcast.net) said,
>>
>> Thank you.
>> I know the DSQUERY doesn't fail,
>
>But it does- Jerold is right- you should get a DN as a result of a
>straight dsquery user command.
>
>> What I need to know is how to pipe
>> the result from DSQUERY to DSMOD Group to add a member.
>
>Until we figure out why your dsquery isn't working (and it isn't),
>that's not really likely to be possible. :)
>>
>> I was trying to show that I was successful making other changes. The
>> sad history if the thread is below.
>
>Understood, but see the other replies- you *should* get a DN when you
>run dsquery user -samid ross. Something is wrong here. What happens
>if you try it with a different account?
>
>Laura
>>
>>