2020 | Scott W. Head  |  Sr. Systems Admin | Certified Microsoft Windows Server Administrator

PowerShell Local Account Password Reset


    Script to reset account password on local account on remote machines

    This can be used to query some computers and reset password on a account

    Enter account information at prompt


 #Paramater for inbound Data
    Try {
      $account = [ADSI]("WinNT://$Env:ComputerName/$($PassedArray[0]),user")
      Return "`tPassword Change completed successfully"
    Catch {      
      Return "`tFailed to Change the administrator password. Error: $_"

#Decalre Array to Pass
#Get Input From Users
$PassedArray+= Read-host "Enter Local Account"
$PassedArray+= Read-Host "Enter New Password"
$ServerName =  Read-Host "Enter Server Name"

#Execute Command 
Invoke-Command $ServerName -ScriptBlock $MyCommand -ArgumentList @(,$PassedArray)