IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Windows Discussion :

[Event Viewer] Suivi des connexions


Sujet :

Windows

  1. #1
    Membre expert
    Avatar de LeoAnderson
    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    2 938
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 2 938
    Points : 3 199
    Points
    3 199
    Par défaut [Event Viewer] Suivi des connexions
    Bonjour,

    Mon problème est de savoir qui était connecté tel jour à telle heure sur mon serveur.

    Dans l'event viewer, rubrique "Sécurité", j'ai bien une entrée de type logon et une autre de type logoff avec un ID de session que j'imagine unique.
    Mais j'ai pas forcément une folle envie de me taper les milliers de lignes pour noter début & fin pour au final, avoir les sessions encore actives à l'heure qui m'intérêsse

    J'imagine qu'un tel outil/script doit exister ?

    Leo.

  2. #2
    Membre expérimenté
    Avatar de Senji
    Inscrit en
    Juillet 2008
    Messages
    1 144
    Détails du profil
    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 144
    Points : 1 391
    Points
    1 391
    Par défaut
    Salut,

    stratégies d'audit.

    bye

  3. #3
    Membre expert
    Avatar de LeoAnderson
    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    2 938
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 2 938
    Points : 3 199
    Points
    3 199
    Par défaut
    Citation Envoyé par Senji Voir le message
    Salut,

    stratégies d'audit.

    bye
    bonjour,

    mais encore ????
    tu peux expliquer un peu stp ???

  4. #4
    Membre expérimenté
    Avatar de Senji
    Inscrit en
    Juillet 2008
    Messages
    1 144
    Détails du profil
    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 144
    Points : 1 391
    Points
    1 391
    Par défaut
    GO ICI

    bye

  5. #5
    Membre expert
    Avatar de LeoAnderson
    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    2 938
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 2 938
    Points : 3 199
    Points
    3 199
    Par défaut
    merci mais ça répond pas à mon besoin.

    Dans l'event viewer, j'ai d'ores et déjà les infos de logon et logoff.
    des messages du style :
    Ouverture de session réseau réussie :
    Utilisateur : leo
    Domaine : dvp
    Id. de la session : (0x0,0x15E64)
    Type de session : 2
    Processus de session : User32
    Package d'authentification : Negotiate
    Station de travail : pcleo

    par contre, comment je sais qui était connecté le 23/02/2009 à 12h15 ?

  6. #6
    Membre expérimenté
    Avatar de Senji
    Inscrit en
    Juillet 2008
    Messages
    1 144
    Détails du profil
    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 144
    Points : 1 391
    Points
    1 391
    Par défaut
    salut.

    tu peux essayer ce script

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     LastLogon.vbs
    ' VBScript program to determine when each user in the domain last logged
    ' on.
    '
    ' ----------------------------------------------------------------------
    ' Copyright (c) 2002 Richard L. Mueller
    ' Hilltop Lab web site - http://www.rlmueller.net
    ' Version 1.0 - December 7, 2002
    ' Version 1.1 - January 17, 2003 - Account for null value for lastLogon.
    ' Version 1.2 - January 23, 2003 - Account for DC not available.
    ' Version 1.3 - February 3, 2003 - Retrieve users but not contacts.
    ' Version 1.4 - February 19, 2003 - Standardize Hungarian notation.
    ' Version 1.5 - March 11, 2003 - Remove SearchScope property.
    ' Version 1.6 - May 9, 2003 - Account for error in IADsLargeInteger
    '                             property methods HighPart and LowPart.
    ' Version 1.7 - January 25, 2004 - Modify error trapping.
    ' Version 1.8 - July 6, 2007 - Modify how IADsLargeInteger interface
    '                              is invoked.
    '
    ' Because the lastLogon attribute is not replicated, every Domain
    ' Controller in the domain must be queried to find the latest lastLogon
    ' date for each user. The lastest date found is kept in a dictionary
    ' object. The program first uses ADO to search the domain for all Domain
    ' Controllers. The AdsPath of each Domain Controller is saved in an
    ' array. Then, for each Domain Controller, ADO is used to search the
    ' copy of Active Directory on that Domain Controller for all user
    ' objects and return the lastLogon attribute. The lastLogon attribute is
    ' a 64-bit number representing the number of 100 nanosecond intervals
    ' since 12:00 am January 1, 1601. This value is converted to a date. The
    ' last logon date is in UTC (Coordinated Univeral Time). It must be
    ' adjusted by the Time Zone bias in the machine registry to convert to
    ' local time.
    '
    ' You have a royalty-free right to use, modify, reproduce, and
    ' distribute this script file in any way you find useful, provided that
    ' you agree that the copyright owner above has no warranty, obligations,
    ' or liability for such use.
    
    Option Explicit
    
    Dim objRootDSE, strConfig, adoConnection, adoCommand, strQuery
    Dim adoRecordset, objDC
    Dim strDNSDomain, objShell, lngBiasKey, lngBias, k, arrstrDCs()
    Dim strDN, dtmDate, objDate, objList, strUser
    Dim strBase, strFilter, strAttributes, lngHigh, lngLow
    
    ' Use a dictionary object to track latest lastLogon for each user.
    Set objList = CreateObject("Scripting.Dictionary")
    objList.CompareMode = vbTextCompare
    
    ' Obtain local Time Zone bias from machine registry.
    Set objShell = CreateObject("Wscript.Shell")
    lngBiasKey = objShell.RegRead("HKLM\System\CurrentControlSet\Control\" _
        & "TimeZoneInformation\ActiveTimeBias")
    If (UCase(TypeName(lngBiasKey)) = "LONG") Then
        lngBias = lngBiasKey
    ElseIf (UCase(TypeName(lngBiasKey)) = "VARIANT()") Then
        lngBias = 0
        For k = 0 To UBound(lngBiasKey)
            lngBias = lngBias + (lngBiasKey(k) * 256^k)
        Next
    End If
    
    ' Determine configuration context and DNS domain from RootDSE object.
    Set objRootDSE = GetObject("LDAP://RootDSE")
    strConfig = objRootDSE.Get("configurationNamingContext")
    strDNSDomain = objRootDSE.Get("defaultNamingContext")
    
    ' Use ADO to search Active Directory for ObjectClass nTDSDSA.
    ' This will identify all Domain Controllers.
    Set adoCommand = CreateObject("ADODB.Command")
    Set adoConnection = CreateObject("ADODB.Connection")
    adoConnection.Provider = "ADsDSOObject"
    adoConnection.Open "Active Directory Provider"
    adoCommand.ActiveConnection = adoConnection
    
    strBase = "<LDAP://" & strConfig & ">"
    strFilter = "(objectClass=nTDSDSA)"
    strAttributes = "AdsPath"
    strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
    
    adoCommand.CommandText = strQuery
    adoCommand.Properties("Page Size") = 100
    adoCommand.Properties("Timeout") = 60
    adoCommand.Properties("Cache Results") = False
    
    Set adoRecordset = adoCommand.Execute
    
    ' Enumerate parent objects of class nTDSDSA. Save Domain Controller
    ' AdsPaths in dynamic array arrstrDCs.
    k = 0
    Do Until adoRecordset.EOF
        Set objDC = _
            GetObject(GetObject(adoRecordset.Fields("AdsPath").Value).Parent)
        ReDim Preserve arrstrDCs(k)
        arrstrDCs(k) = objDC.DNSHostName
        k = k + 1
        adoRecordset.MoveNext
    Loop
    adoRecordset.Close
    
    ' Retrieve lastLogon attribute for each user on each Domain Controller.
    For k = 0 To Ubound(arrstrDCs)
        strBase = "<LDAP://" & arrstrDCs(k) & "/" & strDNSDomain & ">"
        strFilter = "(&(objectCategory=person)(objectClass=user))"
        strAttributes = "distinguishedName,lastLogon"
        strQuery = strBase & ";" & strFilter & ";" & strAttributes _
            & ";subtree"
        adoCommand.CommandText = strQuery
        On Error Resume Next
        Set adoRecordset = adoCommand.Execute
        If (Err.Number <> 0) Then
            On Error GoTo 0
            Wscript.Echo "Domain Controller not available: " & arrstrDCs(k)
        Else
            On Error GoTo 0
            Do Until adoRecordset.EOF
                strDN = adoRecordset.Fields("distinguishedName").Value
                On Error Resume Next
                Set objDate = adoRecordset.Fields("lastLogon").Value
                If (Err.Number <> 0) Then
                    On Error GoTo 0
                    dtmDate = #1/1/1601#
                Else
                    On Error GoTo 0
                    lngHigh = objDate.HighPart
                    lngLow = objDate.LowPart
                    If (lngLow < 0) Then
                        lngHigh = lngHigh + 1
                    End If
                    If (lngHigh = 0) And (lngLow = 0 ) Then
                        dtmDate = #1/1/1601#
                    Else
                        dtmDate = #1/1/1601# + (((lngHigh * (2 ^ 32)) _
                            + lngLow)/600000000 - lngBias)/1440
                    End If
                End If
                If (objList.Exists(strDN) = True) Then
                    If (dtmDate > objList(strDN)) Then
                        objList.Item(strDN) = dtmDate
                    End If
                Else
                    objList.Add strDN, dtmDate
                End If
                adoRecordset.MoveNext
            Loop
            adoRecordset.Close
        End If
    Next
    
    ' Output latest lastLogon date for each user.
    For Each strUser In objList.Keys
        Wscript.Echo strUser & " ; " & objList.Item(strUser)
    Next
    
    ' Clean up.
    adoConnection.Close
    Set objRootDSE = Nothing
    Set adoConnection = Nothing
    Set adoCommand = Nothing
    Set adoRecordset = Nothing
    Set objDC = Nothing
    Set objDate = Nothing
    Set objList = Nothing
    Set objShell = Nothing
    tiens nous au courant.
    bye

  7. #7
    Membre expert
    Avatar de LeoAnderson
    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    2 938
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 2 938
    Points : 3 199
    Points
    3 199
    Par défaut
    Sur le site de l'auteur (http://www.rlmueller.net/), on trouve la description suivante :
    Last Logon Dates - Two programs to output the last logon date for all users in the domain.

    cela ne correspond donc pas à mon besoin... :S

Discussions similaires

  1. Suivi des connexions à un logiciel
    Par Eckson dans le forum C#
    Réponses: 2
    Dernier message: 14/05/2011, 18h27
  2. connexion puis suivi des enregistrements
    Par warrios dans le forum Access
    Réponses: 2
    Dernier message: 30/01/2007, 08h39
  3. Un fichier de suivi des connexions
    Par KEROZEN dans le forum Access
    Réponses: 2
    Dernier message: 06/05/2006, 14h10
  4. Réponses: 4
    Dernier message: 04/07/2002, 12h31

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo