Re: List users that last logon was 180 days ago
- From: "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 13 Nov 2007 17:29:26 -0600
Gustavo wrote:
Hello guys, I need to find 2 scripts, that help me to list all users in a
domain, where the users never have done logon, and another script that
list
the users that theis last logon was 180 days ago
I have two example VBScript programs that retrieve the last logon dates for
all users in the domain linked here:
http://www.rlmueller.net/Last%20Logon.htm
Because the lastLogon attribute is not replicated, the program lastLogon.vbs
must query ever DC in the domain to find the largest (latest) value for each
user. This should give you what you want. The second program,
LastLogonTimeStamp.vbs requires Windows 2003 functional level and uses the
new lastLogonTimeStamp attribute. In both cases the data "1/1/1601" means
never.
Using LastLogon.vbs to restrict the output to users that have never logged
on, the best method would be to check for this in the last loop where the
results are output. The existing loop is:
' Output latest lastLogon date for each user.
For Each strUser In objList.Keys
Wscript.Echo strUser & " ; " & objList.Item(strUser)
Next
This could be modified as follows:
' Output latest lastLogon date for each user.
For Each strUser In objList.Keys
If (objList.Item(strUser) = #1/1/1601#) Then
Wscript.Echo strUser & " ; " & objList.Item(strUser)
End If
Next
Using LastLogonTimeStamp.vbs, you could change the following:
' Display values for the user.
If (dtmDate = #1/1/1601#) Then
Wscript.Echo strDN & ";Never"
Else
Wscript.Echo strDN & ";" & dtmDate
End If
To this:
' Display values for the user.
If (dtmDate = #1/1/1601#) Then
Wscript.Echo strDN & ";Never"
End If
I hope this helps:
--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--
.
- Follow-Ups:
- Re: List users that last logon was 180 days ago
- From: Richard Mueller [MVP]
- Re: List users that last logon was 180 days ago
- Prev by Date: Re: list computers accounts that never have changed their password
- Next by Date: Re: List users that last logon was 180 days ago
- Previous by thread: Re: list computers accounts that never have changed their password
- Next by thread: Re: List users that last logon was 180 days ago
- Index(es):
Relevant Pages
|