Jump to content

AD Query Script Last Computer Login


Der letzte Beitrag zu diesem Thema ist mehr als 180 Tage alt. Bitte erstelle einen neuen Beitrag zu Deiner Anfrage!

Empfohlene Beiträge

AH ok, bin noch selber darauf gekommen.

 

(&(objectCategory=computer))(lastLogon<=127595195380000000)

 

Hab da so ein Script gefunden das die Zeit(bzw. Datum) umwandelt:

 

' DateToInteger8.vbs

' VBScript program demonstrating how to convert a datetime value to

' the corresponding Integer8 (64-bit) value. The Integer8 value is the

' number of 100-nanosecond intervals since 12:00 AM January 1, 1601,

' in Coordinated Universal Time (UTC). The conversion is only accurate

' to the nearest second, so the Integer8 value will always end in at

' least 7 zeros.

'

' ----------------------------------------------------------------------

' Copyright © 2004 Richard L. Mueller

' Hilltop Lab web site - http://www.rlmueller.net

' Version 1.0 - June 11, 2004

'

' 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 dtmDateValue, dtmAdjusted, lngSeconds, str64Bit

Dim objShell, lngBiasKey, lngBias, k

 

If Wscript.Arguments.Count <> 1 Then

Wscript.Echo "Required argument <DateTime> missing"

Wscript.Echo "For example:"

Wscript.Echo ""

Wscript.Echo "cscript DateToInteger8.vbs ""2/5/2004 4:58:58 PM"""

Wscript.Echo ""

Wscript.Echo "If the date/time value has spaces, enclose in quotes"

Wscript.Quit

End If

 

dtmDateValue = CDate(Wscript.Arguments(0))

 

' 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

 

' Convert datetime value to UTC.

dtmAdjusted = DateAdd("n", lngBias, dtmDateValue)

 

' Find number of seconds since 1/1/1601.

lngSeconds = DateDiff("s", #1/1/1601#, dtmAdjusted)

 

' Convert the number of seconds to a string

' and convert to 100-nanosecond intervals.

str64Bit = CStr(lngSeconds) & "0000000"

Wscript.Echo "Integer8 value: " & str64Bit

Link zu diesem Kommentar
Der letzte Beitrag zu diesem Thema ist mehr als 180 Tage alt. Bitte erstelle einen neuen Beitrag zu Deiner Anfrage!

Schreibe einen Kommentar

Du kannst jetzt antworten und Dich später registrieren. Falls Du bereits ein Mitglied bist, logge Dich jetzt ein.

Gast
Auf dieses Thema antworten...

×   Du hast formatierten Text eingefügt.   Formatierung jetzt entfernen

  Only 75 emoji are allowed.

×   Dein Link wurde automatisch eingebettet.   Einbetten rückgängig machen und als Link darstellen

×   Dein vorheriger Inhalt wurde wiederhergestellt.   Editor-Fenster leeren

×   Du kannst Bilder nicht direkt einfügen. Lade Bilder hoch oder lade sie von einer URL.

×
×
  • Neu erstellen...