User Tools

Site Tools


batchresetadpasswords

Batch Reset AD Passwords

Requirements

  • bash
  • pwgen (or a similar tool)
  • Domain Controller

Step by step

  1. Obtain a list of usernames, one per line
    e.g. ls -1 /Volumes/Homes > userlist.csv
  2. Do a while loop
    while read p
    do echo "$p",`pwgen -y 10 1 | sed 's/,/./g'`
    done <userlist.csv > pwlist.csv
  3. Insert username,password as the first line
  4. Double-check the list for illegal characters
  5. Copy the .csv to a domain controller
  6. Use the following powershell script on the DC, modify the file location:
    Import-Module ActiveDirectory
     
    $users = Import-Csv -Path C:\Users\myuser\pwlist.csv
     
    foreach($user in $users)
    {
        $PlainTextPassword=[string]$user.password
        $NewPassword=ConvertTo-SecureString $PlainTextPassword -AsPlainText -force
        Set-ADAccountPassword -identity $user.username -Reset -NewPassword $NewPassword -Verbose
  7. Execute! :-)
batchresetadpasswords.txt · Last modified: by wolfo

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki