
- 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
‎06-03-2015 09:22 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2015 11:34 AM
To make it more secure, you could add an decryption method to the script and pass the password encrypted.
In the end, the script will still be readable by everyone who has access to the share where the file resides.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2019 04:22 AM
Bert.D wrote:
No it is not.
To make it more secure, you could add an decryption method to the script and pass the password encrypted.
In the end, the script will still be readable by everyone who has access to the share where the file resides.
Hi, Could you please share how we could achieve this. (Sending an encrypted password and then decrypting it at the workstation.
Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2019 07:30 PM
TaherMD wrote:Bert.D wrote:
No it is not.
To make it more secure, you could add an decryption method to the script and pass the password encrypted.
In the end, the script will still be readable by everyone who has access to the share where the file resides.
Hi, Could you please share how we could achieve this. (Sending an encrypted password and then decrypting it at the workstation.
Thanks.
Microsoft has you covered with LAPS:
https://www.microsoft.com/en-us/download/details.aspx?id=46899

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2015 12:02 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2015 03:39 PM
If you want to change the password of a user, you could try something like this.
(FYI: I'm assuming you know the username)
strComputer = "."
sUser = "YourUser"
sPwd = "!NewCompl3xP@ssword!"
Set objUser = GetObject("WinNT://" & strComputer & "/" & sUser & ", user" )
objUser.SetPassword sPwd
objUser.SetInfo
FYI: This is semi-tested code

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2015 01:02 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2015 05:56 PM

