← script library

Reset Active Directory User Passwords in Bulk

Active DirectoryJanuary 5, 2025

Regularly updating user passwords is essential for maintaining security within an organization. In this post, we will provide a PowerShell script that allows administrators to reset passwords for multiple Active Directory user accounts in bulk using a CSV file. This method saves time and ensures that all users can be updated simultaneously. At ServerEngine, we deliver powerful tools for optimizing server administration.

powershell
Import-Module ActiveDirectory

function Reset-ADUserPasswords {
    param (
        [string]$csvPath
    )
    $users = Import-Csv -Path $csvPath
    foreach ($user in $users) {
        $username = $user.UserName
        $newPassword = $user.NewPassword
        try {
            $securePassword = ConvertTo-SecureString $newPassword -AsPlainText -Force
            Set-ADAccountPassword -Identity $username -NewPassword $securePassword
            Write-Host "Successfully reset password for user: $username"
        } catch {
            Write-Host "Failed to reset password for user: $username. Error: $_"
        }
    }
}

Reset-ADUserPasswords -csvPath "C:\Path\To\Your\passwords.csv"

Run it across your fleet

This script runs as-is on a single host. Paste it into ServerEngine to schedule it, run it on a whole server group in parallel, and keep the credentials out of the file — see the scripts documentation and the credential store.

Ready when you are.

Try ServerEngine free for 7 days.