Solved

Need to change passwords of multiple users using a text file

Posted on 2014-09-30
4
268 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 500 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 55

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

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
This article helps those who get the 0xc004d307 error when trying to rearm (reset the license) Office 2013 in a Virtual Desktop Infrastructure (VDI) and/or those trying to prep the master image for Microsoft Key Management (KMS) activation. (i.e.- C…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

718 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