Password Reset Script - Working But Need Alterations.
We have this password reset script it works fine. How do i make an alteration so that it will only reset password an OU called "students" please?
This is our script.
Quote:
Dim sUserName, sDomain, oUser, oNet, sComputer, pw, vbClrf, _
sPword2, sPword3, oComputer
sUserName = InputBox("Please type Username", "Password Change")
bConfirm = MsgBox ("Password to be reset, are you sure?", 4, sUsername)
If bConfirm = 7 then wscript.Quit
Set oNet = CreateObject("Wscript.Network")
sDomain = "HCHS"
sPword = "football"
sComputer = oNet.ComputerName
Set oUser = GetObject("WinNT://" & sDomain & "/" & sUserName & _
",user")
oUser.SetPassword sPword
oUser.Put "PasswordExpired", 1
oUser.SetInfo
WScript.Echo "The password for user account " & chr(13) & chr(13) & sUserName & chr(13) & chr(13) & " in domain " & sDomain & " has been reset to football."
'Additional script to log the changing of passwords
'Dim filesys, testfile
'Set filesys = CreateObject("Scripting.FileSystemObject")
'Set testfile= filesys.CreateTextFile("passwords.txt", True)
'testfile.WriteLine sUsername
'testfile.Close
dim filesys, filetxt
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set filesys = CreateObject("Scripting.FileSystemObject")
Set filetxt = filesys.OpenTextFile("passwords.txt", ForAppending, True)
filetxt.WriteLine sUsername & " , Password reset , " & date & " , " & Time
filetxt.Close
Would i put something like this in?
Quote:
if NOT userou = "Students" then call notstudentaccount
But where would i put that?
Thanks alot