0
1
I need to bulk reset passwords on a local machine (No network or domain just the machine) to a single password; such as %1Percent . I was wondering if this was at all possible with batch or power shell or some sort of script.
0
1
I need to bulk reset passwords on a local machine (No network or domain just the machine) to a single password; such as %1Percent . I was wondering if this was at all possible with batch or power shell or some sort of script.
5
With Powershell (Adminstrator privileges required):
#Requires -RunAsAdministrator
$SecurePassword = Read-Host -Prompt "Enter password for all users" -AsSecureString
$Exclude = "Administrator","Guest","DefaultAccount"
Get-LocalUser |
Where {$Exclude -notcontains $_.Name} |
Set-Localuser -Password $SecurePassword
0
Create text file with extension cmd
such as nuke_users_passwords.cmd
with following content (substitute username and password as you need) and run it
@echo off
net user username1 new_password
net user username2 new_password
...
net user usernameN new_password
Another solution is to use WMI to automatically enumerate local users and change their passwords.
Below is the VBS script with ability to exclude some of account(s) that need to be skipped. Save it as FileName.vbs
and run it "as administrator"
On Error Resume Next
strPasswd = "SuperPassword"
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * from Win32_UserAccount Where LocalAccount = True")
For Each objItem in colItems
Do While True
if objItem.Name = "Guest" then Exit Do ' Skip some account
if objItem.Name = "Administrator" then Exit Do ' Skip some account
if objItem.PasswordChangeable = False then Exit Do '
objItem.SetPassword strPasswd
objItem.SetInfo
Exit Do
Loop
Next
Wscript.Echo "Done."
P.S. Run these scripts "as administrator"
I know this way but I am dealing with possibly hundreds of accounts. It would be better if I didnt have to do one at a time. – TheiMacNoob – 2017-01-16T15:52:37.083
Oh, it make sense. I updated my answer, check it – Alex – 2017-01-16T21:15:24.350
Maybe it would be good if you could add explanations for your script ? – Ob1lan – 2017-01-17T09:49:11.740