PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > ms.win.server.scripting > Re: List users that last logon was 180 days ago
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Re: List users that last logon was 180 days ago

Réponse
 
LinkBack Outils de la discussion
Vieux 14/11/2007, 00h29   #1
Richard Mueller [MVP]
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: List users that last logon was 180 days ago

Gustavo wrote:

> Hello guys, I need to find 2 scripts, that 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 s:

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--


  Réponse avec citation
Vieux 14/11/2007, 00h48   #2
Richard Mueller [MVP]
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: List users that last logon was 180 days ago


"Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in
message news:uoApr0kJIHA.3636@TK2MSFTNGP03.phx.gbl...
> Gustavo wrote:
>
>> Hello guys, I need to find 2 scripts, that 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
>


If you domain is at Windows 2003 functional level, you can use the
lastLogonTimeStamp attribute, which is replicated but is only updated during
logon if the old value is at least 14 days in the past. To query for all
users that have not logged in since 180 days ago, you can query for the
users where lastLogonTimeStamp corresponds to a value smaller than the value
that corresponds to this date. You can use this program to find the Integer8
(64-bit) value (in your time zone) that corresponds to any date:

http://www.rlmueller.net/Programs/DateToInteger8.txt

For example, in my time zone, the date May 13, 2007 (12:00 AM) corresponds
to the Integer8 value:

128235096000000000

A query for all users whose lastLogonTimeStamp attribute corresponds to an
older date would be:

strFilter
"(&(objectCategory=person)(objectClass)(lastLogonT imeStamp<=128235096000000000))"

You can use ADO in a VBScript program to retrieve all of these users. If you
domain is not at W2k3 functional level, the best solution is to simply
retrieve the value of lastLogon for all users.

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 01h39.


Édité par : vBulletin® version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,09981 seconds with 10 queries