Being Administrators, we will come across the situation where we need to reset the passwords for all the Servers and Workstations Local administrator Accounts. we can not go to each machine and reset the passwords.
In this article, we will see how to reset the Local administrator password.
Below command will help in reseting the password for a single machine.
$adminPassword = “Password here”
$adminUser = [ADSI] “WinNT://$computerName/Administrator”
$adminUser.SetPassword($adminPassword)
Now we will elevate it to set for bulk computers. Using the below commands by parsing the bulk computers in the text file as input.
$computer = “C:\users\radhakrishnan.govindan\hosts.txt”
foreach($computerName in $computer)
{
$adminPassword = “Password here”
$adminUser = [ADSI] “WinNT://$computerName/Administrator”
$adminUser.SetPassword($adminPassword)
}
Here, we are using the WMI filter which is faster and easy way to reset even for Windows Server 2003 and latest Windows machines.