Reset ComputerMachinePassword - PowerShell


Reset-ComputerMachinePassword is a PowerShell command that allows you to reset the local computer machine account password. This command is primarily used in situations where the machine account password has been forgotten or compromised, such as during Active Directory domain recovery or troubleshooting authentication issues.


Reset-ComputerMachinePassword [-Credential <PSCredential>] [-Force] [-PassThru]



  • Specifies the credentials to use for resetting the machine account password. This parameter is only required if the current user does not have the necessary permissions to reset the password.


  • Forces the password reset even if the computer is not in a domain.


  • Returns the new machine account password as a secure string.


Simple Reset


Reset Password Using Credentials

$credential = Get-Credential
Reset-ComputerMachinePassword -Credential $credential

Force Password Reset for Local Computer

Reset-ComputerMachinePassword -Force

Get New Password as Secure String

$newPwd = Reset-ComputerMachinePassword -PassThru

Common Issues

  • Access Denied: Ensure that the user running the command has sufficient permissions to reset the machine account password.
  • Computer Not in Domain: If the computer is not in a domain, the -Force parameter must be used.
  • Invalid Credentials: Double-check the credentials provided using the -Credential parameter.


Script to Reset Multiple Computers

$computers = Get-ADComputer -Filter *
foreach ($computer in $computers) {
  Reset-ComputerMachinePassword -ComputerName $computer.Name -Credential $credential

Using with Netdom

Netdom resetpwd /s:server1.domain.local /ud:username /pd:password