title: Using credentials with ADSI to reset a remote local computer account password
body: <p>Trying to change a remote Windows Password using explicit credentials with PowerShell.</p>
  
  <p>I've been able to make this work using the ADSI interface, but the script is running from a non-elevated account, and therefore does not have permissions.  I need to ask the user for an elevated account, and then use that account when making the connection.</p>
  
  <p>This works:</p>
  
  <pre><code>$server = "Server1"
  $adminID = "Administrator"
  $Password = "NewPassword"
  $OldPassword = "OldPassword"
  
  ([ADSI] "WinNT://$server/$adminID").SetPassword($Password)
  </code></pre>
  
  <p>But, I need to also include the old password for the account, so that I have permissions to make the change.</p>
  
  <p>Is there a way to make the connection to the server as <code>$AdminD</code> with the <code>$OldPassword</code>, and then change it to <code>$NewPassword</code>?</p>