Hi I am trying to create/run a script to change the local administrator password on a list of servers off of a text file. I have had no success and I thought this would be pretty easy. Below is the script I foraged from different users trying to do the same thing. Please excuse me I am still learning PS so this might be an easy answer or just a stupid mistake on my part. Thanks for any help or advise it is much appreciated!
$computers=Get-Content-PathC:\Temp\serverlist.txt
$user
="administrator"
$Password
=Get-Content-PathC:\Temp\password.txt
Start-Transcript
c:\temp\pwlogging.txt
$PasswordCount
=0
Foreach
($computerin$computers) {
$newpass
=[adsi]"WinNT://$computer/$user"
$newpass
.SetPassword($Password[$PasswordCount])
$newpass
.SetInfo()
$PasswordCount
++
echo
"Setting password for$computer$userto$($Password[$PasswordCount])"
}
Stop-Transcript