
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎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
- Labels:
-
Share(d) Packages

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2022 11:49 AM
Thanks for the script but I coludn't made it work. I can send commands via webui but this script isn't working and gives the browser configuration error. Default actions are working but not this one. Am I missing something?
Thanks in advance.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2019 03:39 PM
I just launch one command :
net user Administrateur YourPassword /active:yes
No vbs needed

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2019 01:22 AM
Florian_Eigsi wrote:
Hi,
I just launch one command :net user Administrateur YourPassword /active:yes
No vbs needed
I do something similar as when I joined this company the local admin password was set randomly on machines and not on others, it was a real hassle when we would get machines back having to bypass the login all the time.
So we pushed this out to every machine but also added it to our SOE.
net user administrator PASSWORD /active:yes
net accounts /MaxPWAge:UNLIMITED
net user Administrator /expires:never
REG ADD HKLM\Software\Lansweeper /v AdminAcctEnabled /t REG_DWORD /d 1
The last command is so we can report on those that have had the password set correctly, if not, we can re-deploy it via a scheduled report or some other means.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2018 02:23 PM
How to rename user account

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2017 10:45 PM
I know this feed is pretty old but I hope someone sees this.
Can this be used on certain OU's or will it change every password in active directory?
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2015 04:17 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2015 03:40 PM

If you know the name of the user you are trying to change, don't make it too hard on yourself

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2015 03:06 PM
On Error Resume Next
strComputer = "."
Set oShell = CreateObject("WScript.Shell")
sUser = "scc2"
sPwd = "newpasswordhere"
Set Arg = WScript.Arguments
sPwd = Arg(0) 'Pass the password as parameter to the script
'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(sidssc2, 3)="1001") and trim(left(sidAdmin,9)="S-1-5-21-333333333-22222222-111111111-1001")
then
'Echo = echo & "Name: " & objItem.Name & vbcrlf
'Echo = echo & "SID: " & sidscc2
sUser = objItem.Name
Set oUser = GetObject("WinNT://" & strComputer & "/" & sUser)
' Set the password
oUser.SetPassword sPwd
oUser.Setinfo
exit for
end if

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2015 04:55 PM
