title: Can I change the server administrator password using PowerShell SecureString?
body: <p>I'm looking to write a script that will change the administrator password on a remote server using PowerShell. The following command will do this</p>
  
  <pre><code>$Admin=[adsi]("WinNT://" + MyServer + "/Administrator, user")
  $Admin.SetPassword("NewPassword")
  </code></pre>
  
  <p>But I would like to be able to hide the <code>"NewPassword"</code> in the script to make it more secure.</p>
  
  <p>So is there a way to save the <code>"NewPassword"</code> to a secure .txt file then be able to use it like this?</p>
  
  <pre><code>$Admin.SetPassword("$secureFile")
  </code></pre>
  
  <p>The script will be run as a scheduled task.</p>