2. Active Directory Tasks - Powershell

2.4 Resetting a Computer Account

Like a user account, a computer account interacts with Active Directory using a password. But for computer accounts, a password change is initiated every 30 days by default and the password is exempted from the domainโ€™s password policy. Password changes are driven by the client (computer), not AD.

Computer credentials usually unknown to the user because they are randomly set by the computer. But you can set your own password; here is a PowerShell script for doing so:

$pc = read-host -Prompt "Input computer name to reset" # Specify the computer name.
$pwd = read-host -Prompt "Input random characters for temp password" -AsSecureString # Specify the password.
Get-ADComputer $pc | Set-ADAccountPassword -NewPassword:$pwd -Reset:$true