| Author |
Message |
David
Guest
|
Posted:
Wed Jan 05, 2005 2:11 am Post subject:
Password reset for a list of users |
|
|
Hello all, I'm currently looking for a script which basically resets the
password for all the user accounts in a textfile to for example "welcome".
I have about 200 test account that need password to be reset. (also I don't
know the existing passwords)
thanks all.
--
D |
|
| Back to top |
|
 |
Ray Costanzo [MVP]
Guest
|
Posted:
Wed Jan 05, 2005 2:15 am Post subject:
Re: Password reset for a list of users |
|
|
Hi D
If your file, C:\users.txt, looks like this:
asmith
bjones
tderstine
mjones
you could open a command prompt and enter:
for /f %a in (C:\users.txt) do (net user %a welcome /domain)
--
Ray at work
Microsoft ASP/ASP.NET MVP
"David" <davidnyg@gmail.com> wrote in message
news:36929E09-3464-45D9-A2AB-C5231C597BBF@microsoft.com...
| Quote: | Hello all, I'm currently looking for a script which basically
resets the
password for all the user accounts in a textfile to for example
"welcome".
I have about 200 test account that need password to be reset.
(also I don't
know the existing passwords)
thanks all.
--
D |
|
|
| Back to top |
|
 |
David
Guest
|
Posted:
Wed Jan 05, 2005 2:23 am Post subject:
Re: Password reset for a list of users |
|
|
Thanks very much I'm going to give this a shot, is there a way to do this
using vbscript/adsi?
thanks again.
"Ray Costanzo [MVP]" wrote:
| Quote: | Hi D
If your file, C:\users.txt, looks like this:
asmith
bjones
tderstine
mjones
you could open a command prompt and enter:
for /f %a in (C:\users.txt) do (net user %a welcome /domain)
--
Ray at work
Microsoft ASP/ASP.NET MVP
"David" <davidnyg@gmail.com> wrote in message
news:36929E09-3464-45D9-A2AB-C5231C597BBF@microsoft.com...
Hello all, I'm currently looking for a script which basically
resets the
password for all the user accounts in a textfile to for example
"welcome".
I have about 200 test account that need password to be reset.
(also I don't
know the existing passwords)
thanks all.
--
D
|
|
|
| Back to top |
|
 |
Ray Costanzo [MVP]
Guest
|
Posted:
Wed Jan 05, 2005 2:36 am Post subject:
Re: Password reset for a list of users |
|
|
Yes, you could use ADSI. I personally tend not to use ADSI when
there's a "good ol'" way of doing something. As a result of that
habit, my ASDI skills aren't that good. :] But here's an effort.
Note the "good ol'" way is just one simple line. When a shell method
exists, it's been my experience that it's typically much, much
simpler.
Dim aUsers
aUsers = Userlist("C:\users.txt")
For i = 0 To UBound(aUsers, 1)
Call ResetPassword(aUsers(i), "welcome")
Next
Sub ResetPassword(username, password)
Dim sUserpath, oUser
sUserpath = "WinNT://yourDomain/" & username & ",user"
Set oUser = GetObject(sUserpath)
oUser.setPassword password
oUser.SetInfo
Set oUser = Nothing
End Sub
Function Userlist(filepath)
''returns user list in a one dimensional array
Dim oFSO, oFile
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFile = oFSO.OpenTextFile(filepath)
Userlist = Split(oFile.Readall, vbCrLf)
oFile.Close : Set oFile = Nothing
Set oFSO = Nothing
End Function
'Not tested!
--
Ray at work
Microsoft ASP/ASP.NET MVP
"David" <davidnyg@gmail.com> wrote in message
news:F66E3D57-2D3B-47F5-9523-08F0981E8CCE@microsoft.com...
| Quote: | Thanks very much I'm going to give this a shot, is there a way to
do this
using vbscript/adsi?
thanks again.
"Ray Costanzo [MVP]" wrote:
Hi D
If your file, C:\users.txt, looks like this:
asmith
bjones
tderstine
mjones
you could open a command prompt and enter:
for /f %a in (C:\users.txt) do (net user %a welcome /domain)
--
Ray at work
Microsoft ASP/ASP.NET MVP
"David" <davidnyg@gmail.com> wrote in message
news:36929E09-3464-45D9-A2AB-C5231C597BBF@microsoft.com...
Hello all, I'm currently looking for a script which basically
resets the
password for all the user accounts in a textfile to for example
"welcome".
I have about 200 test account that need password to be reset.
(also I don't
know the existing passwords)
thanks all.
--
D
|
|
|
| Back to top |
|
 |
David
Guest
|
Posted:
Wed Jan 05, 2005 3:41 am Post subject:
Re: Password reset for a list of users |
|
|
Great! I tested it an it works.
thanks for all your help.
D
"Ray Costanzo [MVP]" wrote:
| Quote: | Yes, you could use ADSI. I personally tend not to use ADSI when
there's a "good ol'" way of doing something. As a result of that
habit, my ASDI skills aren't that good. :] But here's an effort.
Note the "good ol'" way is just one simple line. When a shell method
exists, it's been my experience that it's typically much, much
simpler.
Dim aUsers
aUsers = Userlist("C:\users.txt")
For i = 0 To UBound(aUsers, 1)
Call ResetPassword(aUsers(i), "welcome")
Next
Sub ResetPassword(username, password)
Dim sUserpath, oUser
sUserpath = "WinNT://yourDomain/" & username & ",user"
Set oUser = GetObject(sUserpath)
oUser.setPassword password
oUser.SetInfo
Set oUser = Nothing
End Sub
Function Userlist(filepath)
''returns user list in a one dimensional array
Dim oFSO, oFile
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFile = oFSO.OpenTextFile(filepath)
Userlist = Split(oFile.Readall, vbCrLf)
oFile.Close : Set oFile = Nothing
Set oFSO = Nothing
End Function
'Not tested!
--
Ray at work
Microsoft ASP/ASP.NET MVP
"David" <davidnyg@gmail.com> wrote in message
news:F66E3D57-2D3B-47F5-9523-08F0981E8CCE@microsoft.com...
Thanks very much I'm going to give this a shot, is there a way to
do this
using vbscript/adsi?
thanks again.
"Ray Costanzo [MVP]" wrote:
Hi D
If your file, C:\users.txt, looks like this:
asmith
bjones
tderstine
mjones
you could open a command prompt and enter:
for /f %a in (C:\users.txt) do (net user %a welcome /domain)
--
Ray at work
Microsoft ASP/ASP.NET MVP
"David" <davidnyg@gmail.com> wrote in message
news:36929E09-3464-45D9-A2AB-C5231C597BBF@microsoft.com...
Hello all, I'm currently looking for a script which basically
resets the
password for all the user accounts in a textfile to for example
"welcome".
I have about 200 test account that need password to be reset.
(also I don't
know the existing passwords)
thanks all.
--
D
|
|
|
| Back to top |
|
 |
|
|
|
|