Tinus EngOps Wiki


OpsaC - Operating as PowerShell code



PowerShell Blog

PowerShell Index

PowerShell Search

Additional Websites

View my GitHub Profile

View my GitHub Gists

View Tinus IT Wiki

View my Photo Website


tags: PowerShell categories: PowerShell-Active-Directory

Table of Contents

Reset the password

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

Change user’s password

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

See also

Set-ADAccountPassword on Microsoft Docs.

[ Top ] [ Blog ]