Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.
'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
Join the community of 500,000 technology professionals and ask your questions.