← script library
Automate User Password Resets in Active Directory with PowerShell
Active DirectoryDecember 24, 2024
In this post, we will showcase a PowerShell script that automates the password reset process for user accounts in Active Directory. Managing user passwords efficiently is critical for maintaining security and compliance within organizations. This script allows administrators to reset the passwords for multiple users in bulk, streamlining the process and reducing the time spent on manual updates. Here is the PowerShell script for resetting user passwords in Active Directory:
powershell
# Import the Active Directory module
Import-Module ActiveDirectory
# Define the new password and users
$newPassword = ConvertTo-SecureString "NewSecurePassword!" -AsPlainText -Force
$usersToReset = @("user1", "user2", "user3") # Replace with actual usernames
# Reset password for each user
foreach ($user in $usersToReset) {
try {
Set-ADAccountPassword -Identity $user -NewPassword $newPassword -Reset
Write-Host "Password for $user has been reset successfully." -ForegroundColor Green
} catch {
Write-Host "Failed to reset password for $user: $_" -ForegroundColor Red
}
}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.
More in Active Directory
Active Directory User Onboarding with PowerShell
2026-08-17Active Directory User Offboarding with PowerShell
2026-08-17Disable an Active Directory User with PowerShell
2026-08-17Enable an Active Directory User with PowerShell
2026-08-17Unlock an Active Directory Account with PowerShell
2026-08-17Reset an Active Directory Password with PowerShell
2026-08-17Ready when you are.
Try ServerEngine free for 7 days.