OpsaC - Operating as PowerShell code
published: November 10, 2020 author: Tinu tags: PowerShell categories: PowerShell-Active-Directory
This example reset the user’s password without to provide the old password.
Set-ADAccountPassword -Identity $env:USERNAME -NewPassword (Read-Host "Provide a new password for $($env:USERNAME)" -AsSecureString) -Reset -PassThru
This example resets the user’s password by specifying the old password.
Set-ADAccountPassword -Identity $env:USERNAME -OldPassword (Read-Host "enter the current password for $($env:USERNAME)" -AsSecureString) -NewPassword (Read-Host "provide a new password for $($env:USERNAME)" -AsSecureString) -PassThru
Set-ADAccountPassword on Microsoft Docs.