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 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409
| <html xmlns:v="urn:schemas-microsoft-com:vml" XMLNS:t="urn:schemas-microsoft-com:time">
<head>
<title>ValUsrMgt</title>
<HTA:APPLICATION
ID="ValUsrMgt"
APPLICATIONNAME="ValUsrMgt"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
CAPTION="yes"
>
</head>
<style>
<!--
v\:* {behavior:url(#default#VML);}
BODY
{
background-color: buttonface;
font-family: Helvetica;
font-size: 10pt;
margin-top: 10px;
margin-left: 10px;
margin-right: 10px;
margin-bottom: 10px;
}
#ListView1 {
font-size: 11px;
}
.button
{
font-family: Helvetica;
font-size: 8pt;
}
-->
</STYLE>
<SCRIPT Language="VBScript">
DomValue = "dc=fabrikam,dc=com"
Sub Window_Onload
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor")
For Each objItem in colItems
intHorizontal = objItem.ScreenWidth
intVertical = objItem.ScreenHeight
Next
XPos = 970
YPos = 720
intLeft = (intHorizontal - XPos) / 2
intTop = (intVertical - YPos) / 2
self.ResizeTo Xpos,YPos
window.moveTo intLeft, intTop
ListView1.font = "arial"
ListView1.View = 3
ListView1.GridLines = True
ListView1.ColumnHeaders.Add , , "User Name", 80
ListView1.ColumnHeaders.Add , , "Common Name", 130
ListView1.ColumnHeaders.Add , , "Description", 175
ListView1.ColumnHeaders.Add , , "Status", 70
testsite
End Sub
Sub ListView1_ColumnClick(ColumnHeader)
With ListView1
.Sorted = False
.SortKey = ColumnHeader.Index - 1
If .SortOrder = 0 Then
.SortOrder = 1
Else
.SortOrder = 0
End If
.Sorted = True
End With
End Sub
Sub TestSite
NomLog.Value = ""
NomUsr.Value = ""
NomAD.Value = ""
PNomUsr.Value = ""
Affich.Value = ""
Desc.Value = ""
Bureau.Value = ""
DteExp.Value = ""
NomPass.Value = ""
ICpte.Value = 0
ListView1.ListItems.Clear()
Const ADS_UF_DONT_EXPIRE_PASSWD = &H10000
Const E_ADS_PROPERTY_NOT_FOUND = &h8000500D
Const ONE_HUNDRED_NANOSECOND = .000000100
Const SECONDS_IN_DAY = 86400
Const MIN_IN_DAY = 1440, SEC_IN_MIN = 60
on error resume next
Set objDomain = GetObject("WinNT://fabrikam.com")
intMaxPwdAgeSeconds = objDomain.Get("MaxPasswordAge")
intMaxPwdAgeDays = ((intMaxPwdAgeSeconds/SEC_IN_MIN)/MIN_IN_DAY)
If LSites.Value <> "" Then
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 3500
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.Properties("Sort On") = "Name"
objCommand.CommandText = "SELECT distinguishedName FROM 'LDAP://" & DomValue & "' WHERE objectCategory='user'"
Set objRecordSet = objCommand.Execute
IUsr = 0
If objRecordSet.RecordCount > 0 Then
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
StrDn = "LDAP://" & objRecordSet.Fields("distinguishedName").value
Set objUser = GetObject(StrDN)
If objUser.AccountDisabled = True Then
Status = "Disabled"
Else
intTimeInterval = intMaxPwdAgeDays - Int(Now - dtmValue) - 1
If intTimeInterval > 0 Then
Status = "Disabled"
Else
Status = "Enabled"
End If
End If
Set itmx = ListView1.ListItems.Add(, ,objRecordSet.Fields("distinguishedName").value)
itmX.SubItems(1) = objUser.CN
itmX.SubItems(2) = objUser.Description
itmX.SubItems(3) = Status
ICpte.Value = ICpte.Value + 1
objRecordSet.MoveNext
Loop
End If
End If
End Sub
Sub ListView1_Click
NomLog.Value = ""
NomUsr.Value = ""
NomAD.Value = ""
PNomUsr.Value = ""
Affich.Value = ""
Desc.Value = ""
Bureau.Value = ""
DteExp.Value = ""
NomPass.Value = ""
Chk0.Value = 0
Chk1.Value = 0
Chk2.Value = 0
Chk3.Value = 0
Chk5.Value = 0
Chk6.Value = 0
StrDN = "LDAP://" & ListView1.SelectedItem.Text
msgbox "Tu peux insérer ici ta fonction pour afficher tes propres paramètres...."
Set objUser = GetObject (StrDN)
NomLog.Value = objUser.sAMAccountName
NomUsr.Value = objUser.SN
PNomUsr.Value = objUser.givenName
NomAD.Value = objUser.userPrincipalName
Affich.Value = objUser.displayName
Desc.Value = objUser.description
Bureau.Value = objUser.physicalDeliveryOfficeName
Set objDate = objUser.PwdLastSet
dtmPwdLastSet = Integer8Date(objDate, lngBias)
lngFlag = objUser.Get("userAccountControl")
blnPwdExpire = True
Const ADS_UF_DONT_EXPIRE_PASSWD = &H10000
Const E_ADS_PROPERTY_NOT_FOUND = &h8000500D
Const ONE_HUNDRED_NANOSECOND = .000000100
Const SECONDS_IN_DAY = 86400
Const MIN_IN_DAY = 1440, SEC_IN_MIN = 60
on error resume next
Set objDomain = GetObject("WinNT://fabrikam.com")
intMaxPwdAgeSeconds = objDomain.Get("MaxPasswordAge")
intMaxPwdAgeDays = ((intMaxPwdAgeSeconds/SEC_IN_MIN)/MIN_IN_DAY)
dtmValue = objUser.PasswordLastChanged
intUserAccountControl = objUser.Get("userAccountControl")
intTimeInterval = intMaxPwdAgeDays - Int(Now - dtmValue) - 1
If intTimeInterval < 0 Then
Chk0.Checked = True
Else
Chk0.Checked = False
End If
If Err.Number = E_ADS_PROPERTY_NOT_FOUND Then
Chk1.Checked = True
Else
Chk1.Checked = False
End If
If ((lngFlag And ADS_UF_PASSWD_CANT_CHANGE) <> 0) Then
Chk2.Checked = True
Else
Chk2.Checked = False
End If
If intUserAccountControl And ADS_UF_DONT_EXPIRE_PASSWD Then
Chk3.Checked = True
Else
Chk3.Checked = False
End If
If objUser.AccountDisabled = FALSE Then
Chk5.Value = False
Else
Chk5.Value = True
End If
dtmAccountExpiration = objUser.AccountExpirationDate
If Err.Number = -2147467259 Or dtmAccountExpiration = "01/01/1970" Or dtmAccountExpiration = "01/01/1601 01:00:00" Then
DteExp.Value = ""
Chk6.Checked = True
Else
DteExp.Value = objUser.AccountExpirationDate
Chk6.Checked = False
End If
End Sub
Sub Quitter
self.Close()
End Sub
Function Integer8Date(objDate, lngBias)
' Function to convert Integer8 (64-bit) value to a date, adjusted for
' local time zone bias.
Dim lngAdjust, lngDate, lngHigh, lngLow
lngAdjust = lngBias
lngHigh = objDate.HighPart
lngLow = objdate.LowPart
' Account for bug in IADslargeInteger property methods.
If (lngLow < 0) Then
lngHigh = lngHigh + 1
End If
If (lngHigh = 0) And (lngLow = 0) Then
lngAdjust = 0
End If
lngDate = #1/1/1601# + (((lngHigh * (2 ^ 32)) _
+ lngLow) / 600000000 - lngAdjust) / 1440
Integer8Date = CDate(lngDate)
End Function
</SCRIPT>
<body bgcolor="buttonface">
<Big><Big><Big><ul><u>
<Center>
Script UsrMgt
</Big></Big></Big></ul></u>
</Center>
<table WIDTH="100%" BORDER=1>
<td VALIGN=TOP WIDTH="25%" COLSPAN=1>
<table BORDER=0>
<Center>
<br>
<hr> </hr>
<center>
Number of Users
<hr> </hr>
</Center>
<table WIDTH="100%" BORDER=0>
<Tr style="font-size:8pt;">All Locations:</Tr>
<Tr style="font-size:8pt;">  <input type=text name="ICpte" size="4" READONLY></Tr>
<br><br><br><br><br><br><br>
</Table>
<td WIDTH="25%" valign="top" COLUMN=2>
<td width="465" height="455" style="border: 1px solid #C0C0C0">
<OBJECT ID="ListView1" WIDTH=465 HEIGHT=455 CLASSID="CLSID:BDD1F04B-858B-11D1-B16A-00C0F0283628">
<PARAM NAME="SortKey" VALUE="0">
<PARAM NAME="View" VALUE="3">
<PARAM NAME="Arrange" VALUE="0">
<PARAM NAME="LabelEdit" VALUE="1">
<PARAM NAME="SortOrder" VALUE="0">
<PARAM NAME="Sorted" VALUE="-1">
<PARAM NAME="MultiSelect" VALUE="0">
<PARAM NAME="LabelWrap" VALUE="-1">
<PARAM NAME="HideSelection" VALUE="0">
<PARAM NAME="HideColumnHeaders" VALUE="0">
<PARAM NAME="OLEDragMode" VALUE="0">
<PARAM NAME="OLEDropMode" VALUE="0">
<PARAM NAME="AllowReorder" VALUE="-1">
<PARAM NAME="Checkboxes" VALUE="0">
<PARAM NAME="FlatScrollBar" VALUE="0">
<PARAM NAME="FullRowSelect" VALUE="-1">
<PARAM NAME="GridLines" VALUE="-1">
<PARAM NAME="HotTracking" VALUE="0">
<PARAM NAME="HoverSelection" VALUE="0">
<PARAM NAME="PictureAlignment" VALUE="0">
<PARAM NAME="TextBackground" VALUE="0">
<PARAM NAME="ForeColor" VALUE="-2147483640">
<PARAM NAME="BackColor" VALUE="-2147483624">
<PARAM NAME="BorderStyle" VALUE="0">
<PARAM NAME="Appearance" VALUE="0">
<PARAM NAME="MousePointer" VALUE="0">
<PARAM NAME="Enabled" VALUE="1">
<PARAM NAME="NumItems" VALUE="0">
<param name="OLEDragMode" value="0">
<param name="OLEDropMode" value="0">
</OBJECT>
<hr> </hr>
<Center>
Search Zone
<hr> </hr>
<td VALIGN=TOP>
<table border=0 cols=2>
<colgroup span="2">
<col width=330></Col>
<col width=570></Col>
</tr>
<tr><th COLSPAN=2 style="font-size:8pt;"><hr> Users infos<hr></th></tr>
<tr style="font-size:8pt;"><td>User Logon Name:</td><td><input type=text name="NomLog" size="20" READONLY></td><tr>
<tr style="font-size:8pt;"><td>Last Name :</td><td><input type="text" name="NomUsr" size="20" READONLY></td></tr>
<tr style="font-size:8pt;"><td>First Name :</td><td><input type="text" name="PNomUsr" size="20" READONLY></td></tr>
<tr style="font-size:8pt;"><td>Full Logon Name :</td><td><input type="text" name="NomAD" size="30" READONLY></td></tr>
<tr style="font-size:8pt;"><td>Display name : </td><td><input type="text" name="Affich" size="30" READONLY></td></tr>
<tr style="font-size:8pt;"><td>Description : </td><td><input type="text" name="Desc" size="46" READONLY></td></tr>
<tr style="font-size:8pt;"><td>Office : </td><td><input type="text" name="Bureau" size="46" READONLY></td></tr>
<tr><th COLSPAN=2 style="font-size:8pt;"><hr>Account & Password<hr></th></tr>
<table border=0 cols=3>
<colgroup span="3">
<col width=230></Col>
<col width=170></Col>
<col width=50></Col>
</tr>
<tr style="font-size:8pt;"><td>Password expired :</td><td><input type="checkbox" name="Chk0" disabled="disabled"></td><td></td><tr>
<tr style="font-size:8pt;"><td>User must change password at next logon :</td><td><input type="checkbox" name="Chk1" disabled="disabled"></td><td></td><tr>
<tr style="font-size:8pt;"><td>User cannot change password :</td><td><input type="checkbox" name="Chk2" disabled="disabled"></td><td></td><tr>
<tr style="font-size:8pt;"><td>Password never expires :</td><td><input type="checkbox" name="Chk3" disabled="disabled"></td><td></td></tr>
<tr style="font-size:8pt;"><td>New password :</td><td><input type="password" name="NomPass" size="18"></td><td></td></tr>
<tr style="font-size:8pt;"><td>Account is disabled :</td><td><input type="checkbox" name="Chk5" disabled="disabled"></td><td></td><tr>
<tr style="font-size:8pt;"><td>Account never expires :</td><td><input type="checkbox" name="Chk6" disabled="disabled"></td><td></td></tr>
<tr style="font-size:8pt;"><td>Account expires on :</td><td><input type="text" name="DteExp" size="18" READONLY></td><td></td></tr>
</table>
</td>
</tr>
<table WIDTH="100%" BORDER=1>
<td VALIGN=TOP WIDTH="25%" COLSPAN=2>
<table BORDER=0>
<center>
</table>
<fieldset>
<br>
 <input id=Quitbutton class="button" type="button" value=" Quit " name="Quitter_Button" onClick="Quitter">
</center>
<br>
</fieldset>
</body>
</html> |
Partager