Solved

Need to change passwords of multiple users using a text file

Posted on 2014-09-30
4
250 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
  • 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 54

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
In this article, I will show you HOW TO: Install VMware Tools for Windows on a VMware Windows virtual machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, using the VMware Host Client. The virtual machine has Windows Server 2016 instal…
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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

786 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