Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script to change password

Status
Not open for further replies.

121321

Technical User
Mar 31, 2011
8
RO
i need a script to change password at admin account everyday a new password.the new passwords will be in a txt file .pls help me.
 
something like this

Code:
set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
set objPWs = objFSO.OpenTextFile("passwords.txt", 2, true, 0)

strComputer = "computer_name"
set objUser = GetObject("WinNT://" & strComputer & "/Administrator, user")

'you'll need something to count the days that pass so you can
'read the correct password.

strFirstDay = "3/31/2011"
intDays = datediff("d", strFirstDay, now)

for i = 0 to intDays
    strPassword = objPWs.ReadLine
next

objUser.SetPassword strPassword
objUser.SetInfo

objPWs.close

-Geates

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
- Martin Golding

"There are seldom good technological solutions to behavioral problems."
- Ed Crowley, Exchange guru and technology curmudgeon
 
thanks.and i want that script to take the passwords from a list made by me with passwords for each day of the week.
 
Like the code above, that'll depend on how the passwords.txt is created/maintained and how it looks. What does your password.txt look like?

-Geates

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
- Martin Golding

"There are seldom good technological solutions to behavioral problems."
- Ed Crowley, Exchange guru and technology curmudgeon
 
something like this :itprinter,
information
computer
information1
 
i really want to learn to make scripts but i do not know what to learn.
 
if it not much too ask u ,to explained me how it works this script because i make it a bat but it can't change the password.
 
Nor would it. Visual Basic Script uses components not available to the batch interpreter.

I started in QBasic. So the transition to vbs was shift. To find out more about vbs, just google "Visual Basic Script tutorials." Also, is, in my eyes, a great reference site.

Think of something simple you want to make (e.g. a guessing game) and evolve it as you learn more. Pretty soon you'll be able to participant in vbs'ing :)

Code:
'define, objFSO as a FileSystemObject
set objFSO = WScript.CreateObject("Scripting.FileSystemObject")

'define, objPWs as a file stream of "psswords.txt"
set objPWs = objFSO.OpenTextFile("passwords.txt", 2, true, 0)

'datepart returns the day (numerical) of the week.
'NOTE: As long as your passwords.txt file starts on Sunday and is changed weekly, your good
intDays = datepart("w", date)

'loop intDays number of times
for i = 1 to intDays
    'read the line that objPWs is currently pointing to within the previously opened stream of "passwords.txt" and set it as strPassword
    strPassword = objPWs.ReadLine
next

'now that we've read the correct amount of lines, use the .SetPassword method of the objUser to set the password we read from the text stream and stored in strPassword
objUser.SetPassword strPassword

'apply the changes we have made to the user.
objUser.SetInfo

'close the text stream
objPWs.close

-Geates

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
- Martin Golding

"There are seldom good technological solutions to behavioral problems."
- Ed Crowley, Exchange guru and technology curmudgeon
 
i want to ask u something.do u know if is a program or a script that do not need to be install on victim pc to see what that person rights on mess if the archive on mess is deleted?
 
victim? I think "user" is a more suitable term - unless your intentions are malicious.

What is "on mess" or "mess"?

-Geates

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
- Martin Golding

"There are seldom good technological solutions to behavioral problems."
- Ed Crowley, Exchange guru and technology curmudgeon
 
i want to ask u something.do u know if is a program or a script that do not need to be install on user pc to see what that person rights on mess if the archive mess is deleted?
 
I still can't follow your question. Sorry.

-Geates

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
- Martin Golding

"There are seldom good technological solutions to behavioral problems."
- Ed Crowley, Exchange guru and technology curmudgeon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top