→ 🚀What's New? Join Us for the Fall Product Launch! Register Now !
‎01-06-2015 01:07 PM - last edited on ‎06-30-2023 03:34 PM by ErikT
Looks up the name of the Local Administrator and resets the password.
Rem: You need to add the password as a parameter.
Rem: If you do not add a password parameter, the password is default set to: !NewCompl3xP@ssword!
Rem: Copy the code below and save it as Reset_Local_Admin_Password.vbs at the {PackageShare}\Scripts folder
On Error Resume Next
strComputer = "."
Set oShell = CreateObject("WScript.Shell")
sUser = "Administrator"
sPwd = "!NewCompl3xP@ssword!"
Set Arg = WScript.Arguments
If Arg.Count > 0 Then
sPwd = Arg(0) 'Pass the password as parameter to the script
End if
'Get the administrator name
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_UserAccount Where LocalAccount = True")
For Each objItem in colItems
sidAdmin = objItem.SID
if trim(right(sidAdmin, 3)="500") and trim(left(sidAdmin,9)="S-1-5-21-") then
'Echo = echo & "Name: " & objItem.Name & vbcrlf
'Echo = echo & "SID: " & sidAdmin
sUser = objItem.Name
Set oUser = GetObject("WinNT://" & strComputer & "/" & sUser)
' Set the password
oUser.SetPassword sPwd
oUser.Setinfo
exit for
end if
Next
‎04-28-2022 11:49 AM
‎04-12-2019 03:39 PM
net user Administrateur YourPassword /active:yes
‎04-15-2019 01:22 AM
Florian_Eigsi wrote:
Hi,
I just launch one command :net user Administrateur YourPassword /active:yes
No vbs needed
‎01-12-2018 02:23 PM
‎09-06-2017 10:45 PM
‎07-16-2015 04:17 PM
‎07-16-2015 03:40 PM
On Error Resume Next
strComputer = "."
Set oShell = CreateObject("WScript.Shell")
sUser = "scc2"
sPwd = "newpasswordhere"
Set oUser = GetObject("WinNT://" & strComputer & "/" & sUser)
oUser.SetPassword sPwd
oUser.Setinfo
‎07-16-2015 03:06 PM
‎06-05-2015 04:55 PM
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now