dsmod - passwords

  • Thread starter Thread starter Glenn
  • Start date Start date
G

Glenn

can someone please explain how to use dsmod to create passwords through a
batch file? I read about someone doing it in another post, but can't find
any info on how to do it.
 
Glenn said:
can someone please explain how to use dsmod to create passwords through a
batch file? I read about someone doing it in another post, but can't find
any info on how to do it.

Do you know how to change ONE password using DSMod?

DSMod user /?

Here's the help's example for chaning a password:

dsmod user "CN=John Doe,CN=Users,DC=domain,DC=com" -pwd A1b2C3d4 -mustchpwd
yes

If you can do that you can use the "For /f " command to parse and
pump in a text file with each set of parameters in a text file.

Here's an example of pulling in (the first 4) parameters from each
line of a text file:

for /f "tokens=1-3" %a in (t.txt) do @echo %a-%b-%c

(t.txt == an arbitrary file name with YOUR date)

This just echo's out the parameters (or tokens) but you can use
this pattern to drive a "dsmod" command.

for /? will give you help on using the for ... in (...) do ... command

Also note you might need to use "quotes" around the tokens in the
file OR in the command if you have multi-word parameters, or in
the file you might wish to use a different "token delimiter" like ":"
in the file and quotes in the command line like the dsmod sample
does.

[following is all on one line ]
for /f "tokens=1-3" %a in (t.txt) do dsmod user "CN=%a
%b,CN=Users,DC=domain,DC=com" -pwd %d -mustchpwd yes

If you drive this from a file called "t.txt" that includes something like:

John Doe A1b2C3d4
Sally Roe B9b8D3d4
Fred Smith C7b6E3d4

(Of course you can play around with adding in the OU
instead of using the "Users" container too.)
 
Will this work on a Windows 2000 server? when I type dsmod it says bad
command.
Herb Martin said:
Glenn said:
can someone please explain how to use dsmod to create passwords through a
batch file? I read about someone doing it in another post, but can't find
any info on how to do it.

Do you know how to change ONE password using DSMod?

DSMod user /?

Here's the help's example for chaning a password:

dsmod user "CN=John Doe,CN=Users,DC=domain,DC=com" -pwd A1b2C3d4 -mustchpwd
yes

If you can do that you can use the "For /f " command to parse and
pump in a text file with each set of parameters in a text file.

Here's an example of pulling in (the first 4) parameters from each
line of a text file:

for /f "tokens=1-3" %a in (t.txt) do @echo %a-%b-%c

(t.txt == an arbitrary file name with YOUR date)

This just echo's out the parameters (or tokens) but you can use
this pattern to drive a "dsmod" command.

for /? will give you help on using the for ... in (...) do ... command

Also note you might need to use "quotes" around the tokens in the
file OR in the command if you have multi-word parameters, or in
the file you might wish to use a different "token delimiter" like ":"
in the file and quotes in the command line like the dsmod sample
does.

[following is all on one line ]
for /f "tokens=1-3" %a in (t.txt) do dsmod user "CN=%a
%b,CN=Users,DC=domain,DC=com" -pwd %d -mustchpwd yes

If you drive this from a file called "t.txt" that includes something like:

John Doe A1b2C3d4
Sally Roe B9b8D3d4
Fred Smith C7b6E3d4

(Of course you can play around with adding in the OU
instead of using the "Users" container too.)
 
Type it from a Windows XP domain member or a Windows Server 2003 domain member or DC.
It will work in a W2K domain from these clients.

Will this work on a Windows 2000 server? when I type dsmod it says bad
command.
Herb Martin said:
Glenn said:
can someone please explain how to use dsmod to create passwords through a
batch file? I read about someone doing it in another post, but can't find
any info on how to do it.

Do you know how to change ONE password using DSMod?

DSMod user /?

Here's the help's example for chaning a password:

dsmod user "CN=John Doe,CN=Users,DC=domain,DC=com" -pwd A1b2C3d4 -mustchpwd
yes

If you can do that you can use the "For /f " command to parse and
pump in a text file with each set of parameters in a text file.

Here's an example of pulling in (the first 4) parameters from each
line of a text file:

for /f "tokens=1-3" %a in (t.txt) do @echo %a-%b-%c

(t.txt == an arbitrary file name with YOUR date)

This just echo's out the parameters (or tokens) but you can use
this pattern to drive a "dsmod" command.

for /? will give you help on using the for ... in (...) do ... command

Also note you might need to use "quotes" around the tokens in the
file OR in the command if you have multi-word parameters, or in
the file you might wish to use a different "token delimiter" like ":"
in the file and quotes in the command line like the dsmod sample
does.

[following is all on one line ]
for /f "tokens=1-3" %a in (t.txt) do dsmod user "CN=%a
%b,CN=Users,DC=domain,DC=com" -pwd %d -mustchpwd yes

If you drive this from a file called "t.txt" that includes something like:

John Doe A1b2C3d4
Sally Roe B9b8D3d4
Fred Smith C7b6E3d4

(Of course you can play around with adding in the OU
instead of using the "Users" container too.)


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
When I try to run the program from a windows XP domain member, I get the
message "DSMOD is not recognized as an internal or external command,
operable program, or batch file"

Is it a separate install?

Jerold Schulman said:
Type it from a Windows XP domain member or a Windows Server 2003 domain member or DC.
It will work in a W2K domain from these clients.

Will this work on a Windows 2000 server? when I type dsmod it says bad
command.
Herb Martin said:
can someone please explain how to use dsmod to create passwords
through
a
batch file? I read about someone doing it in another post, but can't find
any info on how to do it.

Do you know how to change ONE password using DSMod?

DSMod user /?

Here's the help's example for chaning a password:

dsmod user "CN=John Doe,CN=Users,DC=domain,DC=com" -pwd A1b2C3d4 -mustchpwd
yes

If you can do that you can use the "For /f " command to parse and
pump in a text file with each set of parameters in a text file.

Here's an example of pulling in (the first 4) parameters from each
line of a text file:

for /f "tokens=1-3" %a in (t.txt) do @echo %a-%b-%c

(t.txt == an arbitrary file name with YOUR date)

This just echo's out the parameters (or tokens) but you can use
this pattern to drive a "dsmod" command.

for /? will give you help on using the for ... in (...) do ... command

Also note you might need to use "quotes" around the tokens in the
file OR in the command if you have multi-word parameters, or in
the file you might wish to use a different "token delimiter" like ":"
in the file and quotes in the command line like the dsmod sample
does.

[following is all on one line ]
for /f "tokens=1-3" %a in (t.txt) do dsmod user "CN=%a
%b,CN=Users,DC=domain,DC=com" -pwd %d -mustchpwd yes

If you drive this from a file called "t.txt" that includes something like:

John Doe A1b2C3d4
Sally Roe B9b8D3d4
Fred Smith C7b6E3d4

(Of course you can play around with adding in the OU
instead of using the "Users" container too.)


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
Back
Top