-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHelp Desk.hta
More file actions
209 lines (180 loc) · 5.7 KB
/
Copy pathHelp Desk.hta
File metadata and controls
209 lines (180 loc) · 5.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<html>
<head>
<title>Help Desk Console</title>
<HTA:APPLICATION
ID="objORA"
APPLICATIONNAME="HD"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
>
</head>
<style>
BODY
{
background-color: buttonface;
font-family: Helvetica;
font-size: 10pt;
margin-top: 10px;
margin-left: 20px;
margin-right: 20px;
margin-bottom: 10px;
}
.button
{
font-family: Helvetica;
font-size: 8pt;
width: 92px;
}
textarea
{
font-family: arial;
font-size: 8pt;
}
select
{
font-family: arial;
font-size: 8pt;
width: 150px;
margin-left: 0px;
}
td
{
font-family: arial;
font-size: 10pt;
}
</style>
<SCRIPT Language="VBScript">
Window.ResizeTo 600, 250
Window.MoveTo 250, 200
Dim oUser, i
i = 0
Sub Window_Onload
Const ADS_SCOPE_SUBTREE = 2
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adUseClient = 3
PasswordArea.Disabled = True
Set oRootDSE = GetObject("LDAP://RootDSE")
sDomain = oRootDSE.Get("defaultNamingContext")
On Error Resume Next
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
Set objRecordSet = CreateObject("ADODB.Recordset")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = "Select name from 'LDAP://" & sDomain & "' " _
& "Where objectClass='user' AND objectCategory='person' ORDER BY name ASC"
objRecordSet.CursorLocation = adUseClient
objRecordSet.Open objCommand, , adOpenStatic, adLockOptimistic
objRecordSet.MoveFirst
If Err = 0 Then
Do Until objRecordSet.EOF
strLine = objRecordSet.Fields("name").Value
Set objOption = document.createElement("OPTION")
objOption.Text = strLine
objOption.Value = strLine
ADUsers.Add(objOption)
objRecordSet.MoveNext
Loop
End If
End Sub
Sub ADUsers_OnChange()
Set oRootDSE2 = GetObject("LDAP://RootDSE")
sDomain2 = oRootDSE2.Get("defaultNamingContext")
Set oConnection2 = CreateObject("ADODB.Connection")
oConnection2.Provider = "ADsDSOObject"
Set oRecordSet2 = CreateObject("ADODB.Recordset")
Set oCommand2 = CreateObject("ADODB.Command")
oConnection2.Open "Active Directory Provider"
Set oCommand2.ActiveConnection = oConnection2
oCommand2.CommandText = "<LDAP://" & sDomain2 & ">;" _
& "(&(objectCategory=person)(objectClass=user)(name=" _
& ADUsers.Value & "));distinguishedName;" _
& "subTree"
oRecordSet2.Open oCommand2
oRecordSet2.MoveFirst
DataArea1.InnerHTML = oRecordSet2.Fields("distinguishedName")
Set oUser = GetObject("LDAP://" & oRecordSet2.Fields("distinguishedName"))
If oUser.IsAccountLocked = False Then
UserLockedOut.Checked = False
UserLockedOut.Disabled = True
Else
UserLockedOut.Checked = True
UserLockedOut.Disabled = False
End If
End Sub
Sub SaveChanges()
On Error Resume Next
Set oUser = GetObject("LDAP://" & oUser.DistinguishedName)
sResult = sResult & oUser.DisplayName & ":" & VbCrLf
If UserLockedOut.Checked = False Then
If oUser.IsAccountLocked = True Then
oUser.IsAccountLocked = False
oUser.SetInfo
UserLockedOut.Disabled = True
sResult = sResult & vbTab & "Unlocked."
iOperationPerformed = iOperationPerformed + 1
End If
End If
If ResetPassword.Checked Then
sNewPassword = PasswordArea.Value
oUser.SetPassword sNewPassword
If ForcePassChange.Checked Then
oUser.Put "pwdLastSet", 0
End If
oUser.SetInfo
If Err.Number = 0 Then
sResult = sResult & vbTab & "Password reset."
iOperationPerformed = iOperationPerformed + 1
Else
sResult = sResult & vbTab & "An error occurred resetting " _
& "the user's password. Make sure the password meets " _
& "your organization's length and complexity requirements."
Err.Clear
iOperationPerformed = iOperationPerformed + 1
End If
End If
If iOperationPerformed > 0 Then
MsgBox sResult
Else
MsgBox "No changes have been made to " & oUser.DisplayName
End If
End Sub
Sub ResetPassword_OnClick()
i = i + 1
If i Mod 2 = 0 Then
PasswordArea.Disabled = True
Else
PasswordArea.Disabled = False
End If
End Sub
Sub checkEnter()
If Document.ParentWindow.event.keycode = 13 Then
SaveChanges
Else
MsgBox "something...."
' document.ParentWindow.event.cancelbubble = False
' document.ParentWindow.event.returnvalue = True
End If
End Sub
</SCRIPT>
<body STYLE="font:10 pt arial; color:black;
filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=1, StartColorStr='#708090', EndColorStr='#D3D3D3')">
<td width = "23%" valign="top"><b><font color="Black" face="Times New Roman" size="3">Users</font></b><BR><span id="AD Computers">
<select name="ADUsers" style="width:200">
<option value="0"></option>
</select><br>
<span id=DataArea1><font color="Black" face="Times New Roman" size="2"></font></span>
<br><br><b><font color="Black" face="Times New Roman" size="3">New Password</font></b><input type="checkbox"name="ResetPassword"value="1"><font color="Black" face="Times New Roman" size="2">Reset Password?</font><br>
<input type="checkbox"name="ForcePassChange"value="1"checked="True"><font color="Black" face="Times New Roman" size="2">User Must Change Password at Next Logon?</font><br>
<input type="password" name="PasswordArea" size="30">
<input type="checkbox"name="UserLockedOut"value="1"><font color="Black" face="Times New Roman" size="2">USER LOCKED</font><br>
<input id=runbutton1 class="button" type="button" value="Save Changes" name="run_button1" onClick="SaveChanges" title="Commits the new password and/or unlocks the selected user's account">
<body>
</body>
</html>