Today I added a bunch of old computers with different local admin account passwords to our domain. So, since I am all for doing things the easy way I came up with a quick script. I added the computers that I needed the admin account reset on to an active directory OU and applied this script.
‘ On Error Resume Next
Dim objComputer, objWSHNetwork, strComputerName, objUser
Set objWSHNetwork = WScript.CreateObject(“WScript.Network”)
strComputerName = objWSHNetwork.ComputerName
Set objComputer = GetObject(“WinNT://” & strComputerName)
Set objUser = GetObject(“WinNT://” & strComputerName & “/accountname, user”)
objUser.SetPassword “password”
objUser.SetInfo
If you would like to use this with Kaseya all you have to do is copy the above script name and name it password.vbs. Change the variables to meet your needs and then upload it to the server. Then just import the script below and change the path of the password.vbs to match the path of your file.
Script Description: This resets an account password to a password of your choice with no intervention from the user.
THEN
Write File
Parameter 1 : c:temppassword.vbs
Parameter 2 : adminVBSpassword.vbs
OS Type : 0
Execute File
Parameter 1 : c:WINDOWSsystem32wscript.exe
Parameter 2 : c:temppassword.vbs
Parameter 3 : 3
OS Type :
This script pulls the computer name from the computer so it is completely portable. This can also be used to reset any local accounts not just admin accounts and can be pushed through active directory or another script management application like Kaseya or n-able. Remember that wscript.exe is what handles .vbs in windows, so be sure to point the script to the right location (usually c:windowssystem32wscript32.exe). Just change the above accountname to match the account you wish to reset and insert the password you wish to set it to.
#1 by John on March 13, 2009 - 5:39 pm
Great! Just a awesome way to do a mass password reset when someone quits or gets fired. I also managed to toss it on a autorun flash drive to get laptops that are not on the domain. Awesome tool, thanks!