Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Set the same Password for AD users

Posted on 2009-07-15
5
Medium Priority
?
383 Views
Last Modified: 2013-11-09
Set the same Password for some AD users
I have a list of users in a text file these usera are also in Active Directory in different OUs.
I need to set up the same password for only the users that are in the text file. Because some users are in AD and not in the text file and  I don't want to reset their password.

Any script, or any option in AD that can do that?

Thanks
0
Comment
Question by:jskfan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 23

Accepted Solution

by:
rhandels earned 1000 total points
ID: 24858438
Hey,

Using AD USers and Computers it's a no go.. You might be able to use a third party tool in which you can select multiple users all at once..
Here's alink to a vbscripting site that does what you want it to do.. Only thing is i'm not the programmer kinda type, so i hope these guys are right with their code :) :)

http://www.computerperformance.co.uk/Logon/VBScript/VBScript_Windows_passwords.htm
0
 
LVL 15

Assisted Solution

by:Giovanni Heward
Giovanni Heward earned 1000 total points
ID: 24869228
You can use dsmod from the command-line, as described in http://support.microsoft.com/kb/322684

syntax: dsmod user user_dn -pwd new_password

In this case user_DN is the distinguished name (DN) of the user account, for example: CN=Jane Doe,OU=Employees,DC=Contoso,DC=Com

As you are changing user objects in varying OU's, using my attached script, you would change your text file so that each line reflects the distinguished name of each relevant user object... for example:

CN=Jane Doe,OU=Employees,DC=Contoso,DC=Com
CN=John Doe,OU=Employees,DC=Contoso,DC=Com
CN=Testy Testerson,OU=Employees,DC=Contoso,DC=Com

---

Here is sample script which will prompt you for the DN and password...

@echo off
set /p DN=Enter distinguished name of user in quotes:
set /p PWD=Enter new password for user:
dsmod user %DN% -canchpwd yes -pwdneverexpires no
dsmod user %DN% -pwd %PWD% -mustchpwd yes

@echo off
if [%1]==[] (
echo useage: changepass [userlist.txt]
echo         userlist.txt contains DN of each user oject, one per line.
goto :eof
)
setlocal enabledelayedexpansion
set /p pwd=Enter new password for user objects:
for /f %%u in (%1) do (
  call :CHANGEPASS %%u %pwd%
  echo Changed password for %1
)
goto :eof
 
:CHANGEPASS
if [%1]==[] goto :eof
dsmod user %1 -canchpwd yes -pwdneverexpires no
dsmod user %1 -pwd %2 -mustchpwd yes
goto :eof

Open in new window

0
 
LVL 15

Expert Comment

by:Giovanni Heward
ID: 24869243
err.  Make sure to add quotes around the variable entries...

dsmod user "%1" -canchpwd yes -pwdneverexpires no
dsmod user "%1" -pwd "%2" -mustchpwd yes

@echo off
if [%1]==[] (
echo useage: changepass [userlist.txt]
echo         userlist.txt contains DN of each user oject, one per line.
goto :eof
)
setlocal enabledelayedexpansion
set /p pwd=Enter new password for user objects:
for /f %%u in (%1) do (
  call :CHANGEPASS %%u %pwd%
  echo Changed password for %1
)
goto :eof
 
:CHANGEPASS
if [%1]==[] goto :eof
dsmod user "%1" -canchpwd yes -pwdneverexpires no
dsmod user "%1" -pwd "%2" -mustchpwd yes
goto :eof

Open in new window

0
 

Author Comment

by:jskfan
ID: 24890472
Hyena ...worked fine now
0
 
LVL 15

Expert Comment

by:Giovanni Heward
ID: 25109676
Here is a revision of the code with (some) error checking . . .

@echo off
rem. *************************************************************************************************************************
rem.  Solution to set the same password from multiple AD users in varying OUs.
rem.
rem.  Created and posted by Giovanni Heward on Experts-Exchange.com
rem.  http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Windows/viewQuestionPrinterFriendly.jsp?qid=24571799
rem. *************************************************************************************************************************
if [%1]==[] (
	echo.
	echo useage: changepass [userlist.txt]
	echo         Where userlist.txt contains DN of each user oject, one per line.
	echo.         
	echo         Make sure each line does NOT contain quotes, for example:
	echo         CN=Testy Testerson,OU=Employees,DC=Contoso,DC=Com
	echo.
	goto :eof
)
setlocal enabledelayedexpansion
if not exist %1 (echo Active Directory user list DN file [%1] does not exist.&goto :eof)
set /p pwd=Enter new password for all user objects:
for /f "tokens=*" %%u in (%1) do (
 set user=%%u
 call :CHANGEPASS !user! !pwd!
 echo Changed password for !user!
)
goto :eof
 
:CHANGEPASS
if [!user!]==[] goto :eof
dsmod user "!user!" -canchpwd yes -pwdneverexpires no
dsmod user "!user!" -pwd "!pwd!" -mustchpwd yes

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question