1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. gmmg

Beiträge von gmmg

  • Problem mit autoit version 3.3.8.1

    • gmmg
    • 8. März 2012 um 18:53

    water

    wenn d1 <> "dom1" oder d1 <> "dom2" oder "d2" <> "logondnsdomain" dann ende.
    ich hab jetzt einfach das @LogonDNSDomain weggelassen!

    gruß gmmg

  • Problem mit autoit version 3.3.8.1

    • gmmg
    • 8. März 2012 um 15:58

    das heißt ja, das ich nur noch 2 variablen per "OR" verknüpfung abfragen kann! wobei es in den vorigen versionen anders war!

    gruß gmmg

  • Problem mit autoit version 3.3.8.1

    • gmmg
    • 8. März 2012 um 14:58

    @fgreenhorn

    die ersten beiden fälle treffen aber nicht zu und in der vorletzten version hat es noch funktioniert!

    gruß gmmg

  • Problem mit autoit version 3.3.8.1

    • gmmg
    • 8. März 2012 um 14:12

    hallo Xenobiologist

    die abfrage mit einem or geht ja, deshalb wundert es mich, dass wenn ich mehrere logon domains abfrage, das script dann trotzdem in den Exit zweig geht!

    [autoit]

    If @LogonDomain <> "xxx" Or @LogonDNSDomain <> "xxx.INT" Then EXIT

    [/autoit]

    werd das aber dann nochmal genauer testen! hab nur gleich nen meeting :)

    gruß gmmg

  • Problem mit autoit version 3.3.8.1

    • gmmg
    • 8. März 2012 um 13:14

    hallo zusammen,

    ich möchte folgendes abfragen!
    bisher hat die abfrage so immer funktioniert, mit der neuen version funktioniert die "or" abfrage nicht mehr und er beendet das script!

    [autoit]

    If @LogonDomain <> "xxx" Or @LogonDomain <> "xxxx.INT" Or @LogonDNSDomain <> "xxx.INT" Then EXIT

    [/autoit]

    gruß gmmg

  • AD LastloginTimeStamp VB Script nach Autoit

    • gmmg
    • 7. März 2012 um 19:32

    hallo water,

    ok, das werd ich so mal testen!
    heut war ich auf der CEBIT in Hannover :)

    viele grüsse

    gmmg

  • Script/Exe an PC binden (z. B. über MAC Adresse)

    • gmmg
    • 5. März 2012 um 16:45

    @IT-Mensch

    du kannst auch nocht die domain abfragen

    [autoit]

    If @LogonDomain <> "xxxx" Or @LogonDNSDomain <> "xxxx.INT" Then EXIT

    [/autoit]

    oder einen ipadress bereich!

    gruß gmmg

  • Script/Exe an PC binden (z. B. über MAC Adresse)

    • gmmg
    • 5. März 2012 um 15:48

    kann der user der damit arbeiten soll, überhaupt eine exe decompilieren?
    oder machst du dir da jetzt nur sorgen, weil es nicht in den it richtlinien steht, das er keine fremdsoftware nutzen darf!
    ein normaler user, der nicht viel mit it, programmierung zu tun hat, würde auf solch einen gedanken nicht kommen!

    gruß gmmg

  • AD LastloginTimeStamp VB Script nach Autoit

    • gmmg
    • 5. März 2012 um 11:12

    water hab mir fast sowas gedacht! :)

    so, ich teste gleich mal ....

    ergebnis dauer ca. 50 sek!

    ich muss aber unseren sitename übergeben

    [autoit]

    Local $iLLDate = _AD_GetLastLoginDate($aObjects[$i][0],"unser Sitename",$aDC)

    [/autoit]


    wenn ich den auch dynamisch übergebe, dann dauert das script wieder ewigkeiten!
    ich nehme an, weil es nicht in jeder site einen dc gibt!

    macht es sinn, anhand der abfrage des @logonservers, das array" $aDC" zu bereinigen und nur den eintrag zu nehmen?

    gruß und danke
    gmmg

  • AD LastloginTimeStamp VB Script nach Autoit

    • gmmg
    • 5. März 2012 um 11:07

    water

    habe das jetzt mal ausgelesen und statisch den dc wie folgt übergeben!

    [autoit]


    ;------list dc's----
    Local $aDC = _AD_ListDomainControllers()
    ;_ArrayDisplay($aDC, "Active Directory Functions - Example 1 - All Domain Controllers, distinguished name, DNS host name, and the site name")
    ;-------------------
    ;scriptabschnitt _AD_GetLastLoginDate
    Local $iLLDate = _AD_GetLastLoginDate($aObjects[$i][0],"sitename",$aDC[14][0])

    [/autoit]

    hier macht er aber keine abfrage mehr bzw. das array "_ArrayDisplay($alogin)" ist leer ! und es kommt auch kein fehler!
    ohne den 3 parameter wird das array gefüllt!

    gruß gmmg

  • AD LastloginTimeStamp VB Script nach Autoit

    • gmmg
    • 5. März 2012 um 08:38

    hallo water,

    1. das ganze script ohne die Lastlogin funktion läuft 36 sekunden
    2. 2400 user werden in 34 sites abgefragt
    3. 19 domänencontroller, dabei hat aber nicht jede site einen dc, weil es standorte mit nur 2-3 user gibt!

    gruß gmmg

  • AD LastloginTimeStamp VB Script nach Autoit

    • gmmg
    • 2. März 2012 um 18:37

    water

    das war die änderung mit _AD_ListDomainControllers in der AD.au3
    Beitrag:
    Active Directory Funktionen - Neues Beispielskript

    ich häng mal das ganze script an, die daten werden in ein excel sheet geschrieben!
    vielleicht ist da nen geschwindigkeitsproblem!

    Spoiler anzeigen
    [autoit]


    #include <Excel.au3>
    #Include <File.au3>
    #include <AD.au3>
    #include <Array.au3>
    #include <GUIConstantsEx.au3>
    #Include <Date.au3>

    [/autoit] [autoit][/autoit] [autoit]

    ;ldap attribute -> http://www.selfadsi.de/user-attributes-w2k3.htm
    ; excel book erstellen
    ; user nach sites eintragen
    ; user nach company eintragen
    ; user gesamt nach sites eintragen

    [/autoit] [autoit][/autoit] [autoit]

    DIM $oMyRet, $oMyError, $oExcel, $saveas, $sOU
    Local $avArray[1] ,$avArray_01[1], $alogin[1], $aObjects , $aObjects_01, $avArray_10[1], $sValue
    _AD_Open()

    [/autoit] [autoit][/autoit] [autoit]

    ;auslesen der einzelnen OU's
    $aOUs = _AD_GetObjectsInOU($sOU, "(objectCategory=organizationalUnit)", 1, "name") ;"distinguishedName")
    If @error > 0 Then
    MsgBox(64, "Active Directory Functions - Example 2", "No OUs could be found")
    Else
    ;_ArrayDisplay($aOUs, "Active Directory Functions - Example 2 - All OUs starting with: '" & $sOU & "'")
    EndIf
    ;---------------------------------
    ;_ArrayDelete($aOUs, 0) ;löscht 1 eintrag aus dem array
    _ArraySort($aOUs)
    ;_ArrayDisplay($aOUs, "AD all Site OUs!")

    [/autoit] [autoit][/autoit] [autoit]

    ;erstelle excel dokument
    Local $oExcel = _ExcelBookNew() ;Create new book, make it visible
    _ExcelSheetDelete($oExcel, "Sheet1") ;Delete Sheet by string name of SheetName
    _ExcelSheetDelete($oExcel, "Sheet2") ;Delete Sheet by string name of SheetName
    _ExcelSheetDelete($oExcel, "Sheet3") ;Delete Sheet by string name of SheetName
    _ExcelSheetDelete($oExcel, "Tabelle1") ;Delete Sheet by string name of SheetName
    _ExcelSheetDelete($oExcel, "Tabelle2") ;Delete Sheet by string name of SheetName
    ;-----------------------
    Sleep(1000)

    [/autoit] [autoit][/autoit] [autoit]

    For $x = 1 to $aOUs[0]
    ;(lastlogontimestamp<=129171852000000000)
    ;$aObjects = _AD_GetObjectsInOU("OU=User,OU="&$aOUs[$x]&",DC=xxx,DC=int", "(&(objectcategory=person)(objectclass=user)(mail=*)(userAccountControl=512))", 2, "sAMAccountName,mail,company")
    ;$aObjects = _AD_GetObjectsInOU("OU=User,OU="&$aOUs[$x]&",DC=xxx,DC=int", "(&(objectcategory=person)(objectclass=user)(mail=*)(|(userAccountControl=512)(msExchHideFromAddressLists="")(msExchHideFromAddressLists=TRUE)(userAccountControl=66048)))", 2, "sAMAccountName,department,company")
    $aObjects = _AD_GetObjectsInOU("OU=User,OU=Site,DC=xxx,DC=int", "(&(objectcategory=person)(objectclass=user)(mail=*)(|(userAccountControl=512)(msExchHideFromAddressLists="")(msExchHideFromAddressLists=False)(userAccountControl=66048)))", 2, "sAMAccountName,department,company")
    $aObjects_01 = $aObjects
    _ArrayDisplay($aObjects_01)

    [/autoit] [autoit][/autoit] [autoit]

    ;---------------LastLoginDate -----------------------------
    For $i = 1 To $aObjects[0][0]
    Local $result
    Local $iLLDate = _AD_GetLastLoginDate($aObjects[$i][0],"erf01")
    ;Local $iLLDate = _AD_GetLastLoginDate($aObjects[$i][0],$aOUs[$x])
    $result = StringLeft($iLLDate, 8)
    $yyyy = StringTrimRight($result,4)
    $mm = StringTrimLeft($result,4)
    $mm = StringTrimRight($mm,2)
    $dd = StringTrimLeft($result,6)
    $YYYY_MM_DD = $yyyy & "/" & $mm & "/" & $dd & " 00:00:00"
    ;MsgBox(0, "Leftmost 3 characters are:", $result & " " & $YYYY_MM_DD)
    $DateDiff = _DateDiff('D', $YYYY_MM_DD, _NowCalc()) ;"YYYY/MM/DD[ HH:MM:SS]"
    If $DateDiff > 60 Then
    ;MsgBox(0, "Älter 60 Tage:",$aOUs[$x] & " " & $aObjects[$i][0] & " " & $DateDiff & " " & $result)
    _ArrayAdd($alogin, $aObjects[$i][0] & ";" & $DateDiff)

    [/autoit] [autoit][/autoit] [autoit]

    EndIf
    Next
    _ArrayDisplay($alogin)
    ;-------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    If @error > 0 Then
    ;MsgBox(64, "", "Nichts gefunden Error: " & @error)
    Else
    ;$bench = TimerInit() ; laufzeittest
    ;--user pro company in site zählen-----
    $Array_05 = _GetUsers_Summary($aObjects_01) ;dieses Array enthält die Ergebnisse
    $Array_06 = _GetUsers_Summary1($aObjects_01) ;dieses Array enthält die Ergebnisse
    ;If Not @error Then _ArrayDisplay($Array_05)
    ;If Not @error Then _ArrayDisplay($avArray_10)
    ;ConsoleWrite(Round(TimerDiff($bench) / 1000, 4) & " s" & @CRLF) ; laufzeittest ausgabe
    ;--------------------------------------
    _ExcelSheetAddNew($oExcel, $aOUs[$x])
    _ExcelWriteCell($oExcel, "User", 1, 1) ;Write to the Cell
    _ExcelWriteCell($oExcel, "Department", 1, 2) ;Write to the Cell
    _ExcelWriteCell($oExcel, "Company", 1, 3) ;Write to the Cell
    $oExcel.Columns("A:A").ColumnWidth = "30" ;setze spaltenbreite
    $oExcel.Columns("B:B").ColumnWidth = "50" ;setze spaltenbreite
    $oExcel.Columns("C:C").ColumnWidth = "50" ;setze spaltenbreite
    $oExcel.Range("A1:C1") .Font.Bold = TRUE ; setze schriftgrad
    $oExcel.Range("A1:C1") .Font.Size = 14 ; setze schriftgröße
    ;$oExcel.Range("A1:D1") .Font.Color = 0xffffff
    $oExcel.Range("A1:C1") .Interior.ColorIndex = 43 ; setze Farbe
    ;$oExcel.Name = $aOUs[$x]

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 1 To $aObjects[0][0]
    ;MsgBox(0,"", $aObjects[$i][0])
    #CS
    ;---------------LastLoginDate -----------------------------
    Local $result
    Local $iLLDate = _AD_GetLastLoginDate($aObjects[$i][0],"erf01")
    ;Local $iLLDate = _AD_GetLastLoginDate($aObjects[$i][0],$aOUs[$x])
    $result = StringLeft($iLLDate, 8)
    $yyyy = StringTrimRight($result,4)
    $mm = StringTrimLeft($result,4)
    $mm = StringTrimRight($mm,2)
    $dd = StringTrimLeft($result,6)
    $YYYY_MM_DD = $yyyy & "/" & $mm & "/" & $dd & " 00:00:00"
    ;MsgBox(0, "Leftmost 3 characters are:", $result & " " & $YYYY_MM_DD)
    $DateDiff = _DateDiff('D', $YYYY_MM_DD, _NowCalc()) ;"YYYY/MM/DD[ HH:MM:SS]"
    If $DateDiff > 60 Then MsgBox(0, "Älter 60 Tage:",$aOUs[$x] & " " & $aObjects[$i][0] & " " & $DateDiff & " " & $result)
    ;-------------------------------------------------------
    #CE
    $zeile = $i + 1
    IF $aObjects[0][0] <> "" Then
    _ExcelWriteCell($oExcel, $aObjects[$i][0], $zeile, 1)
    _ExcelWriteCell($oExcel, $aObjects[$i][1], $zeile, 2)
    _ExcelWriteCell($oExcel, $aObjects[$i][2], $zeile, 3)
    $oExcel.Range("A"& $zeile &":C"& $zeile) .Interior.ColorIndex = 27 ; setze Farbe
    $oExcel.Range("A1:C"&$zeile).Borders.LineStyle = 1 ; setze einen Rahmen um die Zellen
    EndIf
    Next
    _ArrayAdd($avArray, $aOUs[$x] & ";" & $aObjects[0][0])
    _ExcelWriteCell($oExcel, $aObjects[0][0], $zeile + 2, 2)
    _ExcelWriteCell($oExcel, "All USER " & $aOUs[$x] & ":", $zeile + 2, 1)

    [/autoit] [autoit][/autoit] [autoit]

    $oExcel.Range("A"& $zeile +2 &":B"& $zeile+2) .Interior.ColorIndex = 27 ; setze Farbe
    $oExcel.Range("A1:B"&$zeile +2).Borders.LineStyle = 1 ; setze einen Rahmen um die Zellen
    $oExcel.Range("A"& $zeile +2 &":B"& $zeile+2) .Font.Bold = TRUE ; setze schriftgrad

    [/autoit] [autoit][/autoit] [autoit]

    ;-------schreibe user pro company in excelsheet -------
    For $i = 0 To UBound($Array_05) - 1
    ;MsgBox(0,"", $Array_05[$i][0] & " " &$Array_05[$i][1])
    IF $Array_05[$i][0] = "" Then
    ;MsgBox(0,"",$Array_05[$i][1])
    _ExcelWriteCell($oExcel,"No Department", $zeile + 4 + $i, 1)
    Else
    _ExcelWriteCell($oExcel, $Array_05[$i][0], $zeile + 4 + $i, 1)
    EndIf
    _ExcelWriteCell($oExcel, $Array_05[$i][1], $zeile + 4 + $i, 2)
    $oExcel.Range("A"& $zeile + 4 + $i &":B"& $zeile + 4 + $i) .Interior.ColorIndex = 27 ; setze Farbe
    $oExcel.Range("A1:B"&$zeile + 4 + $i).Borders.LineStyle = 1 ; setze einen Rahmen um die Zellen
    $oExcel.Range("A"& $zeile + 4 +$i &":B"& $zeile + 4 +$i) .Font.Bold = TRUE ; setze schriftgrad
    IF $aObjects[0][0] <> "" Then _ArrayAdd($avArray_01, $aOUs[$x] & ";" & $Array_05[$i][0] & ";" & $Array_05[$i][1]) ; füge daten in array für YGesamt
    Next
    EndIf
    If $aObjects <> "" Then _ArrayAdd($avArray_01, ";;")
    ;-------------------------------------------------------
    Next

    [/autoit] [autoit][/autoit] [autoit]

    ;_ArrayDisplay($avArray_01)

    [/autoit] [autoit][/autoit] [autoit]

    _AD_Close()

    [/autoit] [autoit][/autoit] [autoit]

    _ExcelSheetDelete($oExcel, "Tabelle3") ;Delete Sheet by string name of SheetName
    _ExcelSheetAddNew($oExcel, "YGesamt")
    _ExcelSheetAddNew($oExcel, "ZGesamt")
    _ExcelSheetOrderByName($oExcel, 0)

    [/autoit] [autoit][/autoit] [autoit]

    ;_ArrayDisplay($avArray)

    [/autoit] [autoit][/autoit] [autoit]

    #Region ZGesamt
    ;---------ZGesamt-------------------------
    _ExcelWriteCell($oExcel, "Site", 1, 1) ;Write to the Cell
    _ExcelWriteCell($oExcel, "Anzahl User", 1, 2) ;Write to the Cell
    _ExcelSheetActivate($oExcel, "ZGesamt")
    $oExcel.Columns("A:A").ColumnWidth = "30" ;setze spaltenbreite
    $oExcel.Columns("B:B").ColumnWidth = "50" ;setze spaltenbreite
    $oExcel.Range("A1:B1") .Font.Bold = TRUE ; setze schriftgrad
    $oExcel.Range("A1:B1") .Font.Size = 14 ; setze schriftgröße
    ;$oExcel.Range("A1:D1") .Font.Color = 0xffffff
    $oExcel.Range("A1:B1") .Interior.ColorIndex = 43 ; setze Farbe
    ;$oExcel.Name = $aOUs[$x]

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 1 To _ArrayMaxIndex($avArray, 0, 1)
    ;MsgBox(0,"", $avArray[$i])
    $zeile_1 = $i + 1
    $eintrag = StringSplit($avArray[$i], ";")
    _ExcelWriteCell($oExcel, $eintrag[1], $zeile_1, 1)
    _ExcelWriteCell($oExcel, $eintrag[2], $zeile_1, 2)
    $oExcel.Range("A"& $zeile_1 &":B"& $zeile_1) .Interior.ColorIndex = 27 ; setze Farbe
    $oExcel.Range("A1:B"&$zeile_1).Borders.LineStyle = 1 ; setze einen Rahmen um die Zellen
    Next

    [/autoit] [autoit][/autoit] [autoit]

    _ExcelWriteCell($oExcel, "=Summe(B2:B"& $zeile_1 ,$zeile_1 + 1 , 2) ;Write formula another way Uses A1 referencing, not R1C1
    _ExcelWriteCell($oExcel, "All User",$zeile_1 + 1 , 1) ;Write formula another way Uses A1 referencing, not R1C1
    ; formatiert letzte Zeile
    $oExcel.Range("A"& $zeile_1 +1 &":B"& $zeile_1 + 1) .Interior.ColorIndex = 27 ; setze Farbe
    $oExcel.Range("A"& $zeile_1 +1 &":B"& $zeile_1 + 1).Borders.LineStyle = 1 ; setze einen Rahmen um die Zellen
    $oExcel.Range("A"& $zeile_1 +1 &":B"& $zeile_1 + 1) .Font.Bold = TRUE ; setze schriftgrad

    [/autoit] [autoit][/autoit] [autoit]

    ;---------Ende ZGesamt---------------------
    #EndRegion ZGesamt
    #Region YGesamt
    ;---------YGesamt--------------------------
    _ExcelSheetActivate($oExcel, "YGesamt")
    _ExcelWriteCell($oExcel, "Site", 1, 1) ;Write to the Cell
    _ExcelWriteCell($oExcel, "Department", 1, 2) ;Write to the Cell
    ;_ExcelWriteCell($oExcel, "User", 1, 3) ;Write to the Cell
    _ExcelSheetActivate($oExcel, "YGesamt")
    $oExcel.Columns("A:A").ColumnWidth = "25" ;setze spaltenbreite
    $oExcel.Columns("B:B").ColumnWidth = "30" ;setze spaltenbreite
    ;$oExcel.Columns("C:C").ColumnWidth = "20" ;setze spaltenbreite
    $oExcel.Range("A1:B1") .Font.Bold = TRUE ; setze schriftgrad
    $oExcel.Range("A1:B1") .Font.Size = 14 ; setze schriftgröße
    ;$oExcel.Range("A1:D1") .Font.Color = 0xffffff
    $oExcel.Range("A1:B1") .Interior.ColorIndex = 43 ; setze Farbe
    ;$oExcel.Name = $aOUs[$x]

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 1 To _ArrayMaxIndex($avArray_10, 0, 1)
    ;IF $aObjects[0][0] <> "" Then
    $zeile_1 = $i + 1
    $eintrag = StringSplit($avArray_10[$i], ";")
    _ExcelWriteCell($oExcel, $eintrag[1], $zeile_1, 1)
    _ExcelWriteCell($oExcel, $eintrag[2], $zeile_1, 2)
    ;_ExcelWriteCell($oExcel, $eintrag[3], $zeile_1, 3)
    If $eintrag[1] = "" Then
    $oExcel.Range("A"& $zeile_1 &":B"& $zeile_1).Interior.ColorIndex = 43 ; setze Farbe
    _ExcelWriteCell($oExcel, $eintrag[2], $zeile_1, 3)
    Else
    $oExcel.Range("A"& $zeile_1 &":B"& $zeile_1).Interior.ColorIndex = 27 ; setze Farbe
    EndIf
    $oExcel.Range("A1:B"&$zeile_1).Borders.LineStyle = 1 ; setze einen Rahmen um die Zellen

    [/autoit] [autoit][/autoit] [autoit]

    Next
    ;---------Ende YGesamt---------------------
    #EndRegion ZGesamt

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;$saveas = "C:\User_in Sites"
    ;_ExcelBookSaveAs($oExcel, $saveas, "xls")
    ;_ExcelBookClose($oExcel, 1, 0)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ; Function Name: _ExcelSheetOrderByName($oExcel, $iDesc=0)
    ; Description:: Order ExcelBook-Sheets by name ascending (default) or descending
    ; Parameter(s): $oExcel - Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()
    ; $iDesc - order descending on=1/off=0 (default)
    ; Requirement(s): #Include <Array.au3>
    ; Return Value(s): On Success - Returns 1
    ; On Failure - Returns 0 and sets @error=1 - Specified object does not exist
    ; Author(s): BugFix ([email='bugfix@autoit.de'][/email])
    ;===============================================================================
    Func _ExcelSheetOrderByName($oExcel, $iDesc=0)
    If Not IsObj($oExcel) Then Return SetError(1, 0, 0)
    If $iDesc <> 1 Then $iDesc = 0
    Local $aList = _ExcelSheetList($oExcel)
    _ArraySort($aList, $iDesc)
    Local $pos = 1
    For $i = 0 To UBound($aList) -1
    If $i = 0 Then
    _ExcelSheetMove($oExcel, $aList[$i], $pos, True)
    Else
    _ExcelSheetMove($oExcel, $aList[$i], $pos, False)
    $pos += 1
    EndIf
    Next
    Return 1
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _GetUsers_Summary(ByRef $aObjects_01)
    If Not IsArray($aObjects_01) Then SetError(1, 0, 0)
    _ArrayDelete($aObjects_01, 0)
    If Not IsArray($aObjects_01) Then SetError(2, 0, 0)
    Local $aCompanies = _ArrayUnique($aObjects_01, 2) ; prüfe feld xy
    _ArrayDelete($aCompanies, 0)
    _ArraySort($aCompanies)

    [/autoit] [autoit][/autoit] [autoit]

    Local $aResult[UBound($aCompanies)][2]
    For $i = 0 To UBound($aCompanies) - 1
    $aResult[$i][0] = $aCompanies[$i]
    Next

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 0 To UBound($aResult) - 1
    ;$aTemp = _ArrayFindAll($aObjects_01, $aResult[$i][0], 0, 0, 0, 0, 2)
    $aTemp = _ArrayFindAll($aObjects_01, $aResult[$i][0], 0, 0, 0, 0, 1)
    $aResult[$i][1] = UBound($aTemp)
    Next
    Return $aResult
    EndFunc ;==>_GetUsers_Summary

    [/autoit] [autoit][/autoit] [autoit]

    Func _GetUsers_Summary1(ByRef $aObjects_01)
    If Not IsArray($aObjects_01) Then SetError(1, 0, 0)
    _ArrayDelete($aObjects_01, 0)
    If Not IsArray($aObjects_01) Then SetError(2, 0, 0)
    Local $aCompanies = _ArrayUnique($aObjects_01, 2) ; prüfe feld xy
    _ArrayDelete($aCompanies, 0)
    _ArraySort($aCompanies)

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 0 To UBound($aCompanies) - 1
    _ArrayAdd($avArray_10,$aOUs[$x] & ";" & $aCompanies[$i])
    Next
    If $aObjects_01 <> "" Then _ArrayAdd($avArray_10, ";;")
    EndFunc ;==>_GetUsers_Summary

    [/autoit] [autoit][/autoit] [autoit][/autoit]

    vielleicht lässt sich hier einiges optimieren!

    gruß gmmg

  • AD LastloginTimeStamp VB Script nach Autoit

    • gmmg
    • 2. März 2012 um 16:55

    hallo water :)

    es gibt an jedem standort einen dc! wobei das script jeweils immer nur von einem standord ausgeführt werden soll!

    hier mal der abschnitt mit dem ich das ganze ausführe!

    praktisch vergleiche ich die lastlogintime mit _nowcalc! wenn die tage im beispiel > 60 zeige mir die an oder schreibe die in eine array oder sonstwas!

    [autoit]


    ;---------------LastLoginDate -----------------------------
    For $i = 1 To $aObjects[0][0]
    Local $result
    Local $iLLDate = _AD_GetLastLoginDate($aObjects[$i][0],"sitename")
    ;Local $iLLDate = _AD_GetLastLoginDate($aObjects[$i][0],$aOUs[$x])
    $result = StringLeft($iLLDate, 8)
    $yyyy = StringTrimRight($result,4)
    $mm = StringTrimLeft($result,4)
    $mm = StringTrimRight($mm,2)
    $dd = StringTrimLeft($result,6)
    $YYYY_MM_DD = $yyyy & "/" & $mm & "/" & $dd & " 00:00:00"
    ;MsgBox(0, "Leftmost 3 characters are:", $result & " " & $YYYY_MM_DD)
    $DateDiff = _DateDiff('D', $YYYY_MM_DD, _NowCalc()) ;"YYYY/MM/DD[ HH:MM:SS]"
    If $DateDiff > 60 Then
    ;MsgBox(0, "Älter 60 Tage:",$aOUs[$x] & " " & $aObjects[$i][0] & " " & $DateDiff & " " & $result)
    _ArrayAdd($alogin, $aObjects[$i][0] & ";" & $DateDiff)

    [/autoit][autoit][/autoit][autoit]

    EndIf
    Next
    _ArrayDisplay($alogin)
    ;-------------------------------------------------------

    [/autoit][autoit][/autoit][autoit][/autoit]

    :)

    gruß gmmg

  • AD LastloginTimeStamp VB Script nach Autoit

    • gmmg
    • 2. März 2012 um 16:18

    Hallo Zusammen,

    für eines meiner Scripte benötige ich den AD LastLoginTimeStamp!
    Dieser ist ja in der AD.au3 dabei, aber sehr langsam!

    nun habe ich mir gedacht, ich frage diesen schon beim einlesen über "lastlogontimestamp" ab!

    Spoiler anzeigen
    [autoit]


    $aObjects = _AD_GetObjectsInOU("OU=User,OU="&$aOUs[$x]&",DC=xxx,DC=int", "(&(objectcategory=person)(objectclass=user)(lastlogontimestamp<=129171852000000000))", 2, "sAMAccountName,mail,company")

    [/autoit]

    wenn ich nun hier alle user haben möchte, die sich zum beispiel vor 60 tagen das letzte mal eingeloogt haben, muss ich mir die zahl bei lastlogontimestamp<=129171852000000000 generieren!
    hierzu habe ich auf der inet seite http://www.selfadsi.de/deep-inside/mi…-attributes.htm eine Funktion gefunden, die zeigt, wie man ein Datum in einen Integer8 umwandelt.
    diese möchte ich gern in autoit wandeln!

    [autoit]


    'zeigt den Integer8 Wert des aktuellen Datums+Uhrzeit...

    [/autoit] [autoit][/autoit] [autoit]

    WScript.Echo DateToLargeIntegerString(Now)

    [/autoit] [autoit][/autoit] [autoit]

    Function DateToLargeIntegerString(value)
    'nimmt ein Datun+Uhrzeit und gibt den entsprechenden Microsoft LargeInteger Wert (Integer8) zurück

    [/autoit] [autoit][/autoit] [autoit]

    'erst die lokale Zeitabweichung aus der Registry auslesen
    Set sho = CreateObject("Wscript.Shell")
    timeShiftValue = sho.RegRead("HKLM\System\CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias")
    If IsArray(timeShiftValue) Then
    timeShift = 0
    For i = 0 To UBound(timeShiftValue)
    timeShift = timeShift + (timeShiftValue(i) * 256^i)
    Next
    Else
    timeShift = timeShiftValue
    End If

    [/autoit] [autoit][/autoit] [autoit]

    'die Zeit von lokaler Zeit in UTC umrechnen
    value = DateAdd("n", timeShift, value)

    [/autoit] [autoit][/autoit] [autoit]

    'wieviele Sekunden seit 1601 sind vergangen?
    secs = DateDiff("s", #1/1/1601#, value)

    [/autoit] [autoit][/autoit] [autoit]

    'in Nano-Sekunden umrechnen
    DateToLargeIntegerString = CStr(secs) & "0000000"
    End Function

    [/autoit]


    im englischen forum hab ich nur von lastlogintimestam in lesbares datumsfpormat gefunden!
    http://www.autoitscript.com/forum/topic/86…ript-to-autoit/

    kann man diese funktion einfach umsetzen oder gibt es eventuell dafür schon eine lösung?

    mein bisheriger versuch :(

    [autoit]


    #Include <Date.au3>

    [/autoit][autoit][/autoit][autoit]

    ;last logon timestamp

    [/autoit][autoit][/autoit][autoit]

    $ll_datum = "01.01.2012 00:00:00"

    [/autoit][autoit][/autoit][autoit]

    _DateToLargeIntegerString($ll_datum)

    [/autoit][autoit][/autoit][autoit]

    Func _DateToLargeIntegerString($value)
    ;nimmt ein Datun+Uhrzeit und gibt den entsprechenden Microsoft LargeInteger Wert (Integer8) zurück

    [/autoit][autoit][/autoit][autoit]

    ;erst die lokale Zeitabweichung aus der Registry auslesen
    ;Set sho = CreateObject("Wscript.Shell")
    $timeShiftValue = RegRead("HKLM\System\CurrentControlSet\Control\TimeZoneInformation\","ActiveTimeBias")
    MsgBox(0,"",$timeShiftValue)

    [/autoit][autoit][/autoit][autoit]

    If IsArray($timeShiftValue) Then
    $timeShift = 0
    For $i = 0 To UBound($timeShiftValue)
    $timeShift = $timeShift + ($timeShiftValue($i) * 256^$i)
    Next
    Else
    $timeShift = $timeShiftValue
    EndIf

    [/autoit][autoit][/autoit][autoit]

    ;die Zeit von lokaler Zeit in UTC umrechnen
    $value = _DateAdd("n", $timeShift, $value)
    ;_DateAdd($sType, $iValToAdd, $sDate)

    [/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit][autoit]

    ;wieviele Sekunden seit 1601 sind vergangen?
    $secs = _DateDiff("s", "#1/1/1601#", $value)
    ;_DateDiff($sType, $sStartDate, $sEndDate)

    [/autoit][autoit][/autoit][autoit]

    MsgBox(0,"",$secs)
    ;in Nano-Sekunden umrechnen
    $DateToLargeIntegerString = CStr($secs) & "0000000"

    [/autoit][autoit][/autoit][autoit]

    EndFunc

    [/autoit]

    gruß gmmg

  • Array durchsuchen und Zählen

    • gmmg
    • 2. März 2012 um 11:24

    @sedas
    wie ist das bei einem mehrdimensionalen array?
    leere zeilen müssen auch gezählt werden!

    mein array habe ich ja unten vorgegeben (dieses wird eigentlich aus dem Active Directory ausgelesen)

    Update:

    [autoit]


    alt: $aTemp = _ArrayFindAll($aObjects_01, $aResult[$i][0], 0, 0, 0, 0, 2)
    neu: $aTemp = _ArrayFindAll($aObjects_01, $aResult[$i][0], 0, 0, 0, 0, 1)

    [/autoit]

    danke allen!

    gruß gmmg :)

  • Array durchsuchen und Zählen

    • gmmg
    • 2. März 2012 um 08:43

    ich teste gerade die funktion schrittweise und finde den fehler nicht! zum einfachen testen, hab ich mal das array gleich mit angehangen!
    bei _ArrayFindAll ist irgendwo der wurm drin :(

    Spoiler anzeigen
    [autoit]


    #include <Array.au3>

    [/autoit] [autoit][/autoit] [autoit]

    ; array $aObjects_01
    Local $aObjects_01[7][3]

    [/autoit] [autoit][/autoit] [autoit]

    $aObjects_01[0][0] = "6"
    $aObjects_01[0][1] = "3"

    [/autoit] [autoit][/autoit] [autoit]

    $aObjects_01[1][0] = "beyasa"
    $aObjects_01[1][1] = "Operation Management"
    $aObjects_01[1][2] = "MC"

    [/autoit] [autoit][/autoit] [autoit]

    $aObjects_01[2][0] = "beylch"
    $aObjects_01[2][1] = "Operation Management"
    $aObjects_01[2][2] = "MC"

    [/autoit] [autoit][/autoit] [autoit]

    $aObjects_01[3][0] = "beynha"
    $aObjects_01[3][1] = "Operation Management"
    $aObjects_01[3][2] = "MC"

    [/autoit] [autoit][/autoit] [autoit]

    $aObjects_01[4][0] = "beysal"
    $aObjects_01[4][1] = ""
    $aObjects_01[4][2] = "MC"

    [/autoit] [autoit][/autoit] [autoit]

    $aObjects_01[5][0] = "beysen"
    $aObjects_01[5][1] = "Reservation"
    $aObjects_01[5][2] = "MC"

    [/autoit] [autoit][/autoit] [autoit]

    $aObjects_01[6][0] = "beyshu"
    $aObjects_01[6][1] = ""
    $aObjects_01[6][2] = "MC"

    [/autoit] [autoit][/autoit] [autoit]

    _ArrayDisplay($aObjects_01)

    [/autoit] [autoit][/autoit] [autoit]

    _GetUsers_Summary($aObjects_01)

    [/autoit] [autoit][/autoit] [autoit]

    Func _GetUsers_Summary(ByRef $aObjects_01)
    If Not IsArray($aObjects_01) Then SetError(1, 0, 0)
    _ArrayDelete($aObjects_01, 0)
    If Not IsArray($aObjects_01) Then SetError(2, 0, 0)
    Local $aCompanies = _ArrayUnique($aObjects_01, 2) ; prüfe feld xy
    _ArrayDelete($aCompanies, 0)
    _ArraySort($aCompanies)

    [/autoit] [autoit][/autoit] [autoit]

    Local $aResult[UBound($aCompanies)][2]
    For $i = 0 To UBound($aCompanies) - 1
    $aResult[$i][0] = $aCompanies[$i]
    ;MsgBox(0,"", $aResult[$i][0]) ; gibt mir die einzelnen $aCompanies aus
    Next
    _ArrayDisplay($aResult) ;gibt mir die einzelnen $aCompanies im array aus
    ;_ArrayDisplay($aObjects_01)

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 0 To UBound($aResult) - 1
    MsgBox(0,"", $aResult[$i][0])
    $aTemp = _ArrayFindAll($aObjects_01, $aResult[$i][0], 0, 0, 0, 0, 2)
    MsgBox(0,"", $aTemp) ; ergebnis -1 , das heißt es gibt hier einen fehler
    $aResult[$i][1] = UBound($aTemp)
    Next
    Return $aResult
    EndFunc ;==>_GetUsers_Summary

    [/autoit] [autoit][/autoit] [autoit][/autoit]

    autoBert kannst du hier helfen?

    vielen dank im vorraus ;)

    gruß gmmg

  • Array durchsuchen und Zählen

    • gmmg
    • 1. März 2012 um 14:54

    hallo zusammen,

    aus irgendeinem grund geht die funktion _GetUsers_Summary() nicht mehr!
    ich habe folgenden array! hier möchte ich nun über die funktion _GetUsers_Summary() zählen, wie oft jeder eintrag z.b. Operation Management, Reservation vorkommt!

    [autoit]


    ; array $aObjects_01
    [0]|6|3|
    [1]|beyasa|Operation Management|MC
    [2]|beylch|Operation Management|MC
    [3]|beynha|Operation Management|MC
    [4]|beysal||MC
    [5]|beysen|Reservation|MC
    [6]|beyshu||MC

    [/autoit]

    skript

    Spoiler anzeigen
    [autoit][/autoit] [autoit][/autoit] [autoit]

    $Array_ergebnis = _GetUsers_Summary($aObjects_01)
    If Not @error Then _ArrayDisplay($Array_ergebnis)

    [/autoit] [autoit][/autoit] [autoit]

    Func _GetUsers_Summary(ByRef $aObjects_01)
    If Not IsArray($aObjects_01) Then SetError(1, 0, 0)
    _ArrayDelete($aObjects_01, 0)
    If Not IsArray($aObjects_01) Then SetError(2, 0, 0)
    Local $aCompanies = _ArrayUnique($aObjects_01, 2) ; prüfe feld xy
    _ArrayDelete($aCompanies, 0)
    _ArraySort($aCompanies)
    Local $aResult[UBound($aCompanies)][2]
    For $i = 0 To UBound($aCompanies) - 1
    $aResult[$i][0] = $aCompanies[$i]
    Next
    For $i = 0 To UBound($aResult) - 1
    $aTemp = _ArrayFindAll($aObjects_01, $aResult[$i][0], 0, 0, 0, 0, 2)
    $aResult[$i][1] = UBound($aTemp)
    Next
    Return $aResult
    EndFunc ;==>_GetUsers_Summary

    [/autoit]

    kann da mal bitte einer drüber schauen? die funktion zählt mir nicht mehr, wieviele gleiche einträge in spalte 2 jeweils vorhanden sind (siehe bild2)!

    danke

    gruß gmmg

    Dateien

    array.jpg 39,36 kB – 0 Downloads bild2.jpg 31,93 kB – 0 Downloads
  • Active Directory Funktionen - Neue Version 1.5.0.0 freigegeben!

    • gmmg
    • 1. März 2012 um 11:30

    water

    Danke :)

    gruß gmmg

  • Active Directory Funktionen - Neue Version 1.5.0.0 freigegeben!

    • gmmg
    • 1. März 2012 um 11:10

    water

    versuche eben die funktion _AD_GetLastLoginDate zu benutzen!

    in der AD_1.1.0_Functions bzw. AD_1.0.0_Functions bekomm ich folgenden fehler:

    D:\Data\scripte\AD_1.1.0_Funktions\AD.au3 (1400) : ==> Error in expression.:
    Local $sAD_DsServiceDN = $oAD_DCRootDSE.Get("dsServiceName")
    Local $sAD_DsServiceDN = ^ ERROR

    Spoiler anzeigen
    [autoit]


    #include <AD.au3>

    [/autoit] [autoit][/autoit] [autoit]

    ; Open Connection to the Active Directory
    _AD_Open()
    Global $result
    ;If @error Then Exit MsgBox(16, "Active Directory Example Skript", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended)
    ; Get last login date for the current user
    Global $iLLDate = _AD_GetLastLoginDate("username","sitename")
    MsgBox(64, "Active Directory Functions - Example 1", "Last Login Date for User '" & @UserName & "'" & @CRLF & $iLLDate)
    $result = StringLeft($iLLDate, 8)
    MsgBox(0, "Leftmost 3 characters are:", $result)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ; Close Connection to the Active Directory
    _AD_Close()

    [/autoit]

    mit der Version AD_0.43_Funktions und früher geht es aber!

    kannst du das prüfen?

    danke

    Gruß gmmg ;)

  • Powerpoint Foliennummer abfragen?

    • gmmg
    • 28. Februar 2012 um 15:18

    haste dir die powerpoint.au3 aus dem englischen forum mal angesehen?

    http://www.autoitscript.com/forum/topic/50…rpoint-wrapper/

    gruß gmmg

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™