Share via


PowerShell Tip: Reset AD User Password using PowerShell


Summary


This TechNet Wiki is based on the Script Request Many Organization has there own security policy, this applies to small firm where service desk do massive reset request. Interface will also allow to do but not for bulk users.


Requirement


Need to Rest AD user Password and Force to Change at Next Log on


Solution


This is Possible using PowerShell

help Set-ADAccountPassword -Examples

help Set-ADUser -Examples

Sample Code


$ADuser =  Get-ADUser $userID 
    If($ADuser) 
    { 
        Set-adaccountpassword $userID -reset -newpassword (ConvertTo-SecureString -AsPlainText $password -Force) 
        Set-aduser $userID -changepasswordatlogon $true 
    }

Usage


Reset-ADPassword -userID 'samAccountName' -password 'Default123'

'samAccountName' | Reset-ADUserPassword -password 'Default@123'

'ID1' , 'ID2' | Reset-ADUserPassword -password 'Default@123'

help Reset-ADUserPassword -Examples

Download Code


Download Full Source Code

 Enjoy PowerShell :)