-
Notifications
You must be signed in to change notification settings - Fork 1
/
randomize-local-admin.vbs
33 lines (25 loc) · 1002 Bytes
/
randomize-local-admin.vbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
' A simple script used to randomize the local Administrator account password
' and disable/enable the account
'
' Written by Jeff McJunkin (@jeffmcjunkin, jeffmcjunkin.com)
' May be reused without permission, as long as the original source is attributed
'
' Explanatory blog post at: http://jeffmcjunkin.com/2011/10/03/randomizing-the-local-administrator-account-password/
Set WshNetwork = WScript.CreateObject("WScript.Network")
strComputer = WshNetwork.ComputerName
strComputer = "."
Set objUser = GetObject("WinNT://" & strComputer & "/Administrator,user")
intHighNumber = 255
intLowNumber = 1
password=""
For i= 1 to 120
Randomize
intNumber = Int((intHighNumber - intLowNumber + 1) * Rnd + intLowNumber)
password = password & Chr(intNumber)
Next
objUser.SetPassword password
' If you use something like Kon-Boot instead of NT Password Reset,
' it can be useful to leave the account enabled. In that case,
' set the following line to False
objUser.AccountDisabled = True
objUser.SetInfo