Farben Verändern

  • VBScript

Es gibt 7 Antworten in diesem Thema. Der letzte Beitrag () ist von Agent.

    Denkst du wirklich, dass die User in diesem Forum nichts anderes zu tun haben, ausser dir deine Frage zu beantoworten?

    Ich meine nach gut 3 Stunden, kannst du doch nicht anfangen zu pushen :rolleyes:

    B²T: Poste mal deinen bisherigen Code.

    Lg Chris
    ich danke dir, dass du das zwar beantwortest, aber das bleibt jedem überlassen. grrrrrr. trotzdem danke für die antwort, sorry wenn du dich angegriffen fühlst, aber dieses problem geht mir einfach auf den sack, sorry nochma nicht böse sein:)
    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
    Dim Datum, i, j, zeit
    Dim bZino
    Datum = date() 'AKTUELLES DATUM!!!
    zeit = time() 'aktuelle Zeit
    Wscript.Echo "DATUM : " & Datum
    Wscript.Echo "''''''''''''''''''''''''''''''''''''''''''''''''''''''''' "
    Wscript.Echo "Zeit: " & zeit
    Wscript.Echo "''''''''''''''''''''''''''''''''' "
    Wscript.Echo "User:"
    Wscript.Echo "'''''''''''''"




    ' 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") = 5
    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 = "Name,lastLogon" '+++++++++

    strQuery = strBase & ";" & strFilter & ";" & strAttributes _
    & ";subtree"
    adoCommand.CommandText = strQuery
    'SORTIERE NACH NAMEN!!!!!
    adoCommand.Properties("Sort on") = "Name"
    'wscript.Echo strQuery
    On Error Resume Next
    Set adoRecordset = adoCommand.Execute
    'adoRecordset.sort "Name"
    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("Name").Value
    On Error Resume Next
    Set objDate = adoRecordset.Fields("lastLogon").Value
    bZino = true
    If (Err.Number <> 0) Then
    On Error GoTo 0
    dtmDate = Datum 'äääääää
    ' WScript.Echo "ohne zeit"
    bZino = false
    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 = Datum 'ääää
    ' WScript.Echo "zeit 0"
    bZino = false
    Else
    dtmDate = #1/1/1601# + (((lngHigh * (2 ^ 32)) _
    + lngLow)/600000000 - lngBias)/1440
    End If
    End If
    If LCase(Left(strDN, 1)) = Left(strDN, 1) Then
    bZino = false
    End If
    If Instr(strDN, "_") > 0 Then
    bZino = false
    End If
    If bZino Then
    If (objList.Exists(strDN) = True) Then
    If (dtmDate > objList(strDN)) Then 'üüüü
    objList.Item(strDN) = dtmDate
    End If
    Else
    objList.Add strDN, dtmDate
    End If
    End If
    adoRecordset.MoveNext
    Loop
    adoRecordset.Close
    End If
    Next
    '########################################################################


    ' Letzter Logon für JEDEN USER!!!.
    For Each strUser In objList.Keys
    If DateDiff("d", objList.Item(strUser), Date()) = 0 Then
    Wscript.Echo strUser & " " & objList.Item(strUser)'++++++++++++++++
    'else
    'Wscript.Echo strUser & " " & objList.Item(strUser)

    end if

    next
    Sub VISPROPERTYSET.SetRealColor (Rot, Grün, Blau, Vererbung) As Long

    ' 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




    das zeigt alle angemeldeten user
    ich muss das so umbauen , dass das Nur die angemeldeten user anzeigt und die abmeldedatum von abgemeldeten. und das in 2 verschiedenen farben
    wenn das jemand kann ?:)
    Bitte unterlass endlich diese Doppel- und Dreifachposts, es gibt eine Bearbeitenfunktion! Und wenn dir das Problem auf den Sack geht, lass es nicht an uns aus.
    Gruß, Agent Smith 8-)

    activeFlags = (lazy OR weary)

    Lemgo-Verschwörung | Mathematics | VB-Paradise in blau