Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

How can I change local admin passwords for over 100 servers?

$
0
0

Dear all

Do you know how I can get it work when I would have a list of Servers AND a list of generated passwords?

I'm really new into powershell and really got no idea

I got something like

$computers = Get-Content -Path D:\Powershell\PasswordReset\Serverlist.txt
$user = "administrator"
$Password = Get-Content -Path D:\Powershell\PasswordReset\Passwords.txt
Start-Transcript D:\Powershell\PasswordReset\logging.txt
Foreach($computer in $computers)
{
 $user = [adsi]"WinNT://$computer/$user,user"
 $user.SetPassword($Password)
 $user.SetInfo()
 echo "Server: $computer"
}
Stop-Transcript

But I know it won't work because of of the password list (its not looped!?)

Thank you in advance

A-Learning-Greg :-)


Viewing all articles
Browse latest Browse all 6937

Trending Articles