?
Solved

Need to change passwords of multiple users using a text file

Posted on 2014-09-30
4
Medium Priority
?
274 Views
Last Modified: 2014-10-16
I have about a 100 users that I need to reset their passwords. I can set them to the same password.

How can I do this using a list of users in text file?

I found some script, but nothing really tells what needs to be change and how to do it.

thanks
0
Comment
Question by:rdefino
[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
  • 2
4 Comments
 
LVL 29

Expert Comment

by:becraig
ID: 40353750
If you have PowerShell AD tools you can use this:

gc userlist.txt | % {
Set-ADAccountPassword -identity $_-Reset -NewPassword (ConvertTo-SecureString -AsPlainText "p@ssw0rd" -Force)
}

Open in new window



http://technet.microsoft.com/en-us/library/ee617261.aspx
0
 

Author Comment

by:rdefino
ID: 40353756
Where is the syntax do I enter the password that I want to change to?
0
 
LVL 29

Accepted Solution

by:
becraig earned 2000 total points
ID: 40353761
import-module ac*
gc userlist.txt | % {
Set-ADAccountPassword -identity $_-Reset -NewPassword (ConvertTo-SecureString -AsPlainText "p@ssw0rd" -Force)
}
          

Open in new window

                               

This line imports the active directory module
Import-module ac*

Then we pipe it into a foreach
| % {}

Then to break down the command:
We call Set-AdAccountPassword
Then we specify the user sam account or DN etc
-identity $_ (The $_ represents the value from the text file as a part of the foreach loop)

We then use the reset flag to call a reset without inputting the old password
-reset

Then we set the new password - using conveert-to-securestring so powershell knows it is a valid password.
The password is the value as a part of the plaintext flag
-Asplaintext "password value"

Then we use force to complete this
-Force
0
 
LVL 56

Expert Comment

by:McKnife
ID: 40356135
Alternatively, the most simple batch code:
for /f %%a in (c:\temp\userlist.txt) do net user %%a newpassword /domain

Open in new window

0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

This process allows computer passwords to be managed and secured without using LAPS. This is an improvement on an existing process, enhanced to store password encrypted, instead of clear-text files within SQL
Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

752 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