Changing the Local Admin account on many computers – Powershell

At some point you will be tasked to change the local password on N number of systems. If you have a few systems doing it manually is annoying but doable. If you have many systems that this needs to be done on, doing this in an automated fashion should be the only option. I borrowed and tweaked the random password function from Odd Bits:

In order to use this script you will need to create a txt file called import (this file should be in the same working directory as the ps1 file itself) . In this file should be each computer that needs to have its local admin account changed (in this example I am changing the local admin account). After running a file will be created called export, this will contain any errors that occurred to any systems as well as the server name and password generated if successful.

I hope this helps!

WARNING: Please, Please, Please test this in your own environment before using in production. It works for me but that does not mean it will work for you.

0 comments… add one

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.