Password reset for a list of users
Windows Server Forum Index Windows Server
Server discussion on Windows platform.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web winserverhelp.com
Password reset for a list of users

 
Post new topic   Reply to topic    Windows Server Forum Index -> Programming
Author Message
David
Guest





Posted: Wed Jan 05, 2005 2:11 am    Post subject: Password reset for a list of users Reply with 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
Ray Costanzo [MVP]
Guest





Posted: Wed Jan 05, 2005 2:15 am    Post subject: Re: Password reset for a list of users Reply with 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...
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 Reply with 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:

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 Reply with 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...
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 Reply with quote

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
 
Post new topic   Reply to topic    Windows Server Forum Index -> Programming All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




New Topics Powered by phpBB