title: Powershell Script to reset Local Administrator password
body: <p>I have a script which is to reset local administrator password of remote machines and I have mentioned the host list in the script.But just would like is there any way, so that we can add line in my script, so that this will reset the administrator password of all machine which is there in a specific set of subnet(example :10.241.1.0 and 10.241.2.0)?</p>
  
  <p>Can anyone help me with that ?</p>
  
  <pre><code>$computers = Get-Content -path C:\hosts.txt
  $user = "Administrator"
  $pass = "password1"
  
  Foreach($computer in $computers)
  {
   $user = [adsi]"WinNT://$computer/$user,user"
   $user.SetPassword($pass)
   $user.SetInfo()
  } 
  </code></pre>