Заметки сисадмина » How to change local admin password for all domain computers

Заметки сисадмина о интересных вещах из мира IT, инструкции и рецензии. Настраиваем Компьютеры/Сервера/1С/SIP-телефонию в Москве

How to change local admin password for all domain computers

2023-03-29 · Posted in Active Directory, PowerShell

Microsoft has a Powershell script that will change the local admin account passwords on a list of PCs. The issue is that it creates a random password for each machine and saves it to AD, so this requires that you expand your AD Schema to make it work. That script is here.

This code block I found (somewhere on Stack I think) uses the same method as the MS script, so it seems safe, just add all your PCs to the pcs.txt, with one on each line.

This script is very simple but does work. If a machine is offline then the password will not be updated, and currently errors are not logged anywhere. There is also no error handling so the errors are quite ugly.

Run this as a domain admin somewhere, and obviously don’t put it where a normal user can open it and see the password.

Leave a Reply