Question : VBScript - User Account Usage ( Least used accts, most frequently used accts)

I need a VBScript to report on user acct usage (URGENTLY..)

It -must- report on the following two things (anything additional + relevant is cool)

 - Most frequently used account
 - Least frequently used


I've attached the following code, dont know if it will work because I cant test. It's as far as I got without being completely stumped.

500 Points and a BIG AWESOME THANK YOU to anyone that helps in advance.. I have to hand this in in about .. 9 hours so I hope someone can finish my code
Code Snippet:
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:
'To check the login time and disable the account
Dim dDate, oUser, oObject, oGroup
Dim iFlags, iDiff, iResult
dim arrweeks()
Const UF_ACCOUNTDISABLE = &H0002
 
'Point to group containing users to check
Set oGroup = GetObject("WinNT://MyDomain/Domain Users")
'Enable error trapping
 
On error resume Next
 
'for each user object in the group...
For each oObject in oGroup.Members
x = x + 1
  'ensure the user isn't a computer account!
  If (oObject.Class="User") And _
  (InStr(oObject.Name, "$") = 0) Then
     'retrieve the user object
     Set oUser = GetoObject(oObject.ADsPath)
     'get the last login Date from the domain
     'and strip off the time portion
     '(just need the date)
     dDate = oUser.get("LastLogin")
     dDate = Left(dDate,8)
     dDate = CDate(dDate)
 
     'calculate how long ago that was in weeks
     iDiff = DateDiff("ww", dDate, Now)
 
     'store into an array
 
     arrweeks(x) = idiff
     arrusername(x) = oObject.Name
 
     End If
  End If
Next
 
Do until strcount = 1
y = y + 1
	If arrusername = "" then
	strcount = 1
	else
	msgbox "account name" & vbtab & arrusername(y) & vbcrlf & _
		"how long since last login (weeks)" & vbtab & arrweeks(y) "
	End If
Loop

Answer : VBScript - User Account Usage ( Least used accts, most frequently used accts)

You won't get that info from Active Directory. Its not counting the number of logons, just date and time when the user logs on.
Random Solutions  
 
programming4us programming4us