• Renan Antonio Rodrigues

How to automate and change the local administrator password in Windows

Updated: Mar 30, 2019

If you want to automate and change the local administrator password in Windows, this post shows how to do it.


This VBScript will automate the changing of administrator password on your clients' computer.


Code:


On Error Resume Next

'---===Insert your password here===---

strpassword = "T3st#"

'---===Metodos Set===---

set objComputer = GetObject("WinNT://" & "." & ",computer")

'Set the user you want change the password, in this example will be the user administrator

set objUser = GetObject("WinNT://" & "." & "/administrator, user")

'---===Password's Changing===---

objUser.SetPassword strpassword

objUser.SetInfo()

'--------- End of Script ---------


As you can see, the password is visible and it can be a security issue in your environment if a user finds out it on the network.


To resolve this issue, you need to encrypt the VBS file using an application called "screnc", to download it, click here.


After to have installed this application in your computer, open a prompt as administrator and run the command:


C:\> screnc.exe file.vbs file.vbe


Now, create a new GPO and add the new-generated vbe file on computer startup settings, as shown below:




For any doubts or suggestions, please leave a comment below.

Follow me

© 2023 by Nicola Rider.
Proudly created with
Wix.com
 

  • Branca Ícone LinkedIn