Hi!
I have a script I use to reset passwords for our domain which sets them to a default password that will expire at first logon. This works fine but what I'd like to do to wrap it up in a .hta so I don't have to open it each time I want to use it. The only issue I have is I don't know how to get the strUser to reference the text entered in the input box in my .hta. At preset it launches an additional
input type="text" { font-family: calibri; font-size: 30pt; }table { font-family: calibri; font-size: 11pt; padding: 50px; }
fieldset { padding: 5px; }
legend { font-family: calibri; font-size: 11pt; font-weight: bold; }
select { font-family: calibri; font-size: 11pt; }
</style>
</head>
<script language="VBScript">
Dim intLeft
Dim intTop
Sub Window_onLoad
window.offscreenBuffering = True
window.resizeTo 380,250
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("position.ini", ForReading)
strContents = objFile.ReadAll
objFile.Close
arrContents = Split(strContents, ",")
window.moveTo arrContents(0), arrContents(1)
End Sub
Sub pw_reset
strDomain = "domain.co.uk"
strUser = InputBox ("Confirm Username", "Password Resetter")
strPassword = "default!"
On Error Resume Next
Set objUser = GetObject("WinNT://" & strDomain & "/" & strUser & ",User")
objUser.SetPassword strPassword
objUser.Put "PasswordExpired", 1
objUser.SetInfo
If Err.Number <> 0 Then
MsgBox "Error: An Incorrect Domain Or User Name Was Entered!"
Err.Clear
Else
MsgBox "The Password has been changed to dinosaur1! for " & UCase(strDomain) & "\" & UCase(strUser)
End If
End Sub
</script>
<body>
<!-- Table holding input box-->
<FieldSet><Legend>Enter Username</Legend>
<table border="0" width=100%>
<tr>
<td>
<input type="text" style="font-size:50pt" size="3" maxlength="6" name="logonid" title="userid">
</td>
</tr>
</table>
</FieldSet>
<br>
<input type="button" value="Reset Password" name="PW_button" onClick="pw_reset">
</body>
I'd be grateful if anyone could help