locked
powershell script, change password for multiple users RRS feed

  • Question

    1. Im not a powershell expert so I'm asking some help of you guys here.
      Is there anyone who could make me a script which picks up usernames from a list (lets say a txt file) and creates a new password for all of them

      It needs to be exactly the same password for all the users in the list, no change at logon whatsoever.

      anyone can help me with that?

    Thursday, May 3, 2018 12:30 PM

All replies

  • This would mean that everyone knows everyone's password. This is like not having any passwords.

    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    Thursday, May 3, 2018 1:11 PM
  • Thursday, May 3, 2018 2:55 PM
  • Something like (without the -whatif):


    get-content
    list | get-aduser |
      Set-ADAccountPassword -Reset -NewPassword (
      ConvertTo-SecureString -AsPlainText "qwerty1234" -Force) -whatif







    • Edited by JS2010 Thursday, May 3, 2018 7:07 PM
    Thursday, May 3, 2018 4:34 PM
  • correct, but luckily those are for training accounts, and here its for us important to have 1 single password for each account.

    We also have to be strict and let the passwords expire after 90 days, so each 90 days we would have to set a new password for all users again. and that's what the script would be for. 

    Friday, May 4, 2018 6:55 AM
  • thanks,

    I'll go and try this out. so i should be using it as following

    get-content list | get-aduser | 
      Set-ADAccountPassword -Reset -NewPassword (
      ConvertTo-SecureString -AsPlainText "qwerty1234" -Force)

    where qwerty1234 is the password we choose.

    Friday, May 4, 2018 6:57 AM
  • This is the correct way to do this in bulk:

    $pswd = ConvertTo-SecureString -AsPlainText qwerty1234 -Force
    get-content list | Set-ADAccountPassword -Reset -NewPassword $pswd
    Half as many trios to the server and we do 't regen the same password object each time.


    \_(ツ)_/


    Friday, May 4, 2018 7:07 AM
  • Hi,
    Just checking in to see if the information provided was helpful. Please let us know if you would like further assistance.

    Best Regards,

    Frank

    Please remember to mark the replies as an answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Friday, May 11, 2018 9:52 AM