Quick Help Desk script tool in PowerShell to reset user password :
Clear-Host
Import-Module ActiveDirectory
$newpwd = Read-Host "[ Enter the new password ]" -AsSecureString
$User = Read-Host "[ Enter UserName ]"
Write-Host
Write-Host .. Password Reset for $user -ForegroundColor white -BackgroundColor Red
Write-Host
Set-ADAccountPassword $User -NewPassword $newpwd –Reset
Write-Host "[ Change Report ]" -ForegroundColor -white -BackgroundColor green
Get-ADuser -identity $User -Properties * | Select-Object SamAccountName,PasswordLastSet,Enabled | Format-List
Import-Module ActiveDirectory
$newpwd = Read-Host "[ Enter the new password ]" -AsSecureString
$User = Read-Host "[ Enter UserName ]"
Write-Host
Write-Host .. Password Reset for $user -ForegroundColor white -BackgroundColor Red
Write-Host
Set-ADAccountPassword $User -NewPassword $newpwd –Reset
Write-Host "[ Change Report ]" -ForegroundColor -white -BackgroundColor green
Get-ADuser -identity $User -Properties * | Select-Object SamAccountName,PasswordLastSet,Enabled | Format-List
- Enter new password for the user
- Enter username for user you are trying to reset password
- Shows result for the user that password has been reset
Force the user to change password on first login you need to run this line :
Set-ADUser -identity $User -ChangePasswordAtLogon:$True