Danke euch beiden, hab die Version von Oscar genommen und etwas adaptiert.
Funktioniert 1a
Danke euch beiden, hab die Version von Oscar genommen und etwas adaptiert.
Funktioniert 1a
Nabend,
Ich habe ne Gui mit 2x Guictrlcreatedate (von - bis) Bereich und möchte für jeden Tag in diesem Bereich einen Ordner im format dd-MM-yyyy anlegen.
Stell mich nur mit dem Monatsenden doof an, da es ja keine 40 tage gibt.
Jemand nen scriptbeispiel wie ich das umsetzen kann?
Merci
habs, bisschen eingerostet
danke
ahh er crashed bei dokumente und einstellungen und dieser ist leer, ne idee wie ich das abfangen kann?
dickes danke !
Moin,
ich lasse mir alle dateien mit bestimmten endungen auflisten damit ich diese kopieren kann, das funktioniert wunderbar und wird mir im array auch angezeigt.
jedoch crashed es dann in der for schleife und sagt, dass es das element nicht gibt.
bin ich komplett deppers?
Func copyall()
$drive = StringTrimRight(@WindowsDir, 8)
$files = _FileListToArrayRec($drive & "\", "*|Users;Programme;program files;Program Files (x86);windows;pagefile;System Volume Information;Temporary*;$Recycle*;", 2, 0, 0, 1)
For $i = 1 To $files[0]
$path = _FileListToArrayRec($drive & "\" & $files[$i], "*.xls;*.doc;*.pst;*.ppt;*.mmp;*.mpp;*vsd;*.frm;*.vba;*.vbs;*.url;*.one;*.onetoc", 1, 1, 0, 1)
_ArrayDisplay($path, $files[$i])
For $o = 1 To $path[0] ; <---- crash hier, da $path[0] leer obwohl $path[0] = 2 ?
FileCopy($drive & "\" & $files[$i] & $path[$o], $clines[1] & @ComputerName & "\" & $files[$i] & $path[$o])
Next
Next
EndFunc ;==>copyall
Alles anzeigen
d.h doch $path[$o] sind befüllt oder?
For $o = 1 To $path[0] ; <---- crash hier, da $path[0] leer obwohl $path[0] = 2 ?
Zitat"C:\Users\e1103468\Desktop\Scripte\Supercopy\supercopy.au3" (75) : ==> Subscript used on non-accessible variable.:
For $o = 1 To $path[0]
For $o = 1 To $path^ ERROR
->11:29:03 AutoIt3.exe ended.rc:1
Danke...
![]()
![]()
![]()
![]()
ihr arschies ![]()
Entweder trollt ihr mich alle, oder ich sehe Dinge die ich nicht sehen sollte.
Ich laufe auf Chromium mit Redhat Enterprise und hab mich gewundert das /w username nicht mehr funktioniert. Da es in der Shoutbox angezeigt wird.
Dann kamen alle und meinten "hä? geht doch, ich seh da nix - dein whisper muss angekommen sein".
Fazit, jetzt seh ich wie alpines und xori whispern und sagen ich hätte langeweile ![]()
....
vielen Dank für die Mühe, leider funktioniert die $s-=1 nicht wirklich und ich counte ja schon rückwärts in beiden schleifen, scheitert leider genauso.
Nabend,
ich steh seit paar Stunden aufm Schlauch und weiß nicht wo es hängt, zum Ablauf:
1. Ich lese alle Services im "automatisch Startmode" welche "nicht Running" sind aus und speichere diese in $temp array
2. Ich stelle eine $excluded array bereit mit Services die excluded werden sollen.
Quasi möchte ich Alle Services die nicht Running sind mit denen aus $excluded Liste vergleichen und diese dann in $temp entfernen, damit ich nur Services habe, die im automatisch startmode stehen und nicht running sind und meine "blacklist" beachtet wurde.
Leider hauts beim Arraydelete immer hin. Das Script crashed einfach.
Wenn 4 Services nicht laufen, 3 in der Blacklist sind. Werden 3 abgezogen und er sagt mir "jap hier der Service läuft nicht , soll aber laufen".
Nehme ich aber an, dass alle Services laufen, die Laufen sollen. crashed das Ding.
Sprich 4 nicht running gefunden, 4 auf der blacklist. $temp = leer = crash.
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=serviceadv.exe
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_Change2CUI=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <File.au3>
Global $excludes, $temp[0], $exit[0]
_FileReadToArray(@ScriptDir & "\dependencies\excluded_services.txt", $excludes, 1) ;array count first element
$objWMIService = ObjGet('winmgmts:\\.\root\cimv2')
$colItems = $objWMIService.ExecQuery("Select * From Win32_Service WHERE Startmode='auto'") ;alle Services im Automatisch Mode
If IsObj($colItems) Then
For $objItem In $colItems
If $objItem.State <> "Running" Then ;Wenn automatisch Mode und nicht Running
_ArrayAdd($temp, $objItem.Displayname) ;safe in Array $temp
Else
_ArrayAdd($exit, $objItem.Displayname) ; alle anderen in $exit
EndIf
Next
EndIf
For $s = UBound($temp) - 1 To 0 Step -1
For $x = UBound($excludes) -1 To 0 Step -1
If $temp[$s] = $excludes[$x] Then ;wenn array $temp in $excluded liste dann
_ArrayDelete($temp, $s) ; lösche element ; hier crashed es wenn die excludes komplett in $temp enthalten sind. Also das array komplett geleert wird
EndIf
Next
Next
For $j = 0 To UBound($temp) - 1
$code = "2"
ConsoleWrite($code & "|" & $temp[$j] & " ist down !" & @LF)
If $j == UBound($temp) - 1 Then
Exit ($code)
EndIf
Next
$allitems = UBound($exit)
If $temp = @error Then
$code = 0
ConsoleWrite($code & "|Alle " & $allitems & " Services im automatisch Status laufen!" & @LF)
Exit ($code)
EndIf
Alles anzeigen
Vielen Dank
Upon further analysis and investigation we have verified your submission and, as such, the detection(s) for the following file(s) will be removed from our products:
Filename: Kodi.Texture.exe
MD5: 87D0530B5C9789981481AD8D57BBA345
SHA256: 4D0621F4F624B69CA32C114D3D9D3EB4AF6B6C2D08FF8CF1606282ACC188CD53
Result: Whitelisting for above file is taking effect from now on.
Alles klar, ich danke euch beiden.
Hab den FalsePositive mal submitted, alternativ nehme ich dann nen anderen packer.
Hi Alpi,
definiere "nochmal zupacken" bitte ![]()
komm grad nicht mit.
Will man in Arrays löschen muß man rückwärts iterieren, damit man sich nicht selbst den Ast (Index) absägt, auf dem man sitzt
liegts daran, dass das array kleiner wird wenn ichn delete mache und die forschleife dann nicht mehr hinhaut? how to avoid that?
also lags doch daran ![]()
Ich mache zufällig etwas ähnliches
for $s = UBound($pools) -1 to 0 Step -1
...
nextGehe das Array von hinten nach vorne durch, dann kann man Elemente löschen und $s stimmt immer noch.
Edit: BugFix war schneller
jo rückwärts runtercountern, das wars. ich depp !
Anyway vielen dank ! funzt
Heut ist son Tag, ich sags euch...
irgendwo hab ichn Brainlag.
$pools beinhaltet alle application pools
$pools[0] = 1 element
Ubound($pools) -1 = alle elemente
$excludes beinhaltet alle zu löschenden
$excludes[0] = count
for $s = 0 to UBound($pools) -1
for $x = 1 to $excludes[0]
if StringInStr($pools[$s],$excludes[$x]) Then
msgbox(0,"",$pools[$s] & " ist gleich " & $excludes[$x])
msgbox(0,"","lösche eintrag " & $s &"=" & $pools[$s])
_Arraydelete($pools,$s)
Endif
Next
Next
es passt beim ersten element. Sprich lösche eintrag $s stimmt überein mit der arrayposition
geht die schleife aber dann zum nächsten element, crashed es weil $s eine falsche arrayposition hat. subscript dimension error
liegts daran, dass das array kleiner wird wenn ichn delete mache und die forschleife dann nicht mehr hinhaut? how to avoid that?
Jemand ne idee?
Falls in Zukunft sowas hast kannst auch einfach über das Tool es dir zusammenklicken: https://www.autoitscript.com/forum/files/fi…-warraysupport/
Ich merk schon, bin viel zu inaktiv, war mir sowas von unbekannt, dass wir mitlerweile schon nen scriptomatic haben
nvm.
als admin laufen lassen sollte ich es schon.
Trotzdem Danke Bugfix und chippi die hier schon fleißig am lesen sind ![]()
Moin,
ich versuche das vb script (welches funktioniert) in au3 zu übersetzen.
'------------------------------------------------------------------------------
' IIS v6 Check state of an application pool
' =========================================
'
' Author: Vincent BESANCON (vincent.besancon@faurecia.com)
' Usage:
' check_iis_apppool_state.vbs <pool_name>
' <pool_name> - The name of the application pool.
'
' It returns:
' - OK if state is running.
' - CRITICAL if state is stopped.
' - WARNING if state is stopping or starting.
' - UNKNOWN for all the others (app pool not found, etc...).
'
' Nagios Agent configuration (NSC.INI):
' check_iis_apppool_state=cscript.exe //nologo //T:60 scripts\check_iis_apppool_state.vbs $ARG1$
'------------------------------------------------------------------------------
'
' Args
strArgAppPool = Wscript.Arguments.Unnamed.Item(0)
' Establish the connection to the WMI provider
Set oWMIService = GetObject("winmgmts:root\microsoftiisv2")
' Search the AppPool passed as argument in the list of application pools
Set strQueryAppPools = oWMIService.ExecQuery("Select * from IIsApplicationPoolSetting where Name='W3SVC/AppPools/" & strArgAppPool & "'")
' Enumerate the pools
noError = False
For Each oAppPool in strQueryAppPools
noError = True
' Create nice messages for pool states
Select Case oAppPool.AppPoolState
Case 1
poolState = "Starting"
outputStatus = "WARNING: "
outputCode = 1
Case 2
poolState = "Running"
outputStatus = "OK: "
outputCode = 0
Case 3
poolState = "Stopping"
outputStatus = "WARNING: "
outputCode = 1
Case 4
poolState = "Stopped"
outputStatus = "CRITICAL: "
outputCode = 2
Case else
poolState = "unknown"
outputStatus = "UNKNOWN: "
outputCode = 3
End Select
' Create a clear name for the pool (remove the leading info)
poolName = Replace(oAppPool.Name, "W3SVC/AppPools/", "")
' Output
Wscript.Echo outputStatus & poolName & ", State: " & poolState
Next
' Error handling
If Not noError Then
' Error message
Wscript.echo "UNKNOWN: Error during the WMI query for app pool " & strArgAppPool & " !"
' Exit & return code
WScript.Quit(3)
Else
' Clean exit
WScript.Quit(outputCode)
End If
Alles anzeigen
au3:
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=au3.exe
#AutoIt3Wrapper_UseUpx=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <Array.au3>
$strComputer = "localhost"
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\microsoftiisv2")
If Not IsObj($objWMIService) Then
MsgBox(16, "Error", "$objWMIService is not an object.")
Exit
EndIf
$colItems = $objWMIService.ExecQuery ("Select * from IIsApplicationPoolSetting where Name='W3SVC/AppPools/4b3fc250b9b544ab8b1ee2e585328429'")
_ArrayDisplay($colItems)
For $colItem In $colItems
msgbox(0,"",$colItem.AppPoolState)
Next
Alles anzeigen
egal wie ichs mache, das script beendet sich einfach ohne ergebnisse, ich habe statt localhost auch schon den computernamen genutzt, ändert leider nichts. jemand ne idee?
handelt sich um den iis7 auf win 2008 r2
grüße
Hi,
unzwar suche ich das Eventlog nach einer bestimmten ID, gebe mir dann den User der Eventid aus, dem die Berechtigungen fehlen auf die DCOM Komponente und möchte diese dann über nen cmd command hinzufügen.
Funktioniert lokal (Win7) super. Nur auf unseren Servern 20018R2 passiert nichts außer dass das Script CPU Auslastung frisst, wird als Admin gestartet, Eventeinträge sind da und WMI Query per Powersshell geht. WMI berechtigungen sind auch da.
#include <Array.au3>
#include <Date.au3>
$past_15days = _DateAdd("D", -3, _NowCalc())
$past_15days = StringReplace($past_15days, "/", "")
$past_15days = StringReplace($past_15days, ":", "")
$past_15days = StringStripWS($past_15days, 8)
$past_15days &= ".000000-000"
local $user[30]
$wbemFlagReturnImmediately=0x10
$wbemFlagForwardOnly=0x20
$colItems=""
$strComputer="localhost"
$Output=""
$Output&="Computer: " &$strComputer & @CRLF
$Output&="==========================================" & @CRLF
$objWMIService=ObjGet("winmgmts:\\" &$strComputer &"\root\CIMV2")
$colItems=$objWMIService.ExecQuery("SELECT * FROM Win32_NTLogEvent WHERE LogFile='System' AND EventCode='10016' AND TimeWritten>'" & $past_15days & "'", "WQL");, _
;~ $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
$begin=TimerInit()
If IsObj($colItems) Then
For $objItem In $colItems
$Output&="User: " &$objItem.User & @CRLF
_ArrayAdd($user,$objItem.User)
Next
Else
Msgbox(0, "WMI-Ausgabe","Keine WMI-Objekte gefunden für Klasse: " & "Win32_NTLogEvent")
Endif
$user = _ArrayUnique($user)
$arr2 = _RemoveEmptyArrayElements($user)
for $i = 1 to $arr2[0] -1
Traytip("Hallo",$arr2[$i] & " gefunden - wird hinzugefügt",2,1)
$CMD = 'net localgroup "Distributed COM Users" ' & '"' & $arr2[$i] & '"' &' /add'
RunWait(@ComSpec & " /c " & $CMD)
Next
;RunWait(@ComSpec & " /c " & $CMD)
Func _RemoveEmptyArrayElements ( $_Array )
Local $_Item
For $_Element In $_Array
If $_Element= '' Then
_ArrayDelete ( $_Array, $_Item )
Else
$_Item+=1
EndIf
Next
Return ( $_Array )
EndFunc ;==> _RemoveEmptyArrayElements ( )
Func WMIDateStringToDate($dtmDate)
Return (StringMid($dtmDate, 5, 2) &"/" &StringMid($dtmDate, 7, 2) &"/" &StringLeft($dtmDate, 4) & " " &StringMid($dtmDate, 9, 2) &":" &StringMid($dtmDate, 11, 2) &":" &StringMid($dtmDate,13, 2))
EndFunc
Alles anzeigen
dank dir ! da die tasks mit dem wizard angelegt worden sind, geht das wohl auch nicht.
habe es nun so gelößt:
#include <Constants.au3>
#include <String.au3>
#include <Array.au3>
ConsoleWrite(_getDOSOutput('schtasks /query /fo LIST /tn ' & $CmdLine[1] & ' | findstr /c:"Next Run Time"') & @CRLF)
;ConsoleWrite(_getDOSOutput('schtasks /query /fo LIST /tn ' & $CmdLine[1] & ' | findstr /c:"Nächste Laufzeit"') & @CRLF)
Func _getDOSOutput($command)
Local $text = '', $Pid = Run('"' & @ComSpec & '" /c ' & $command, '', @SW_HIDE, 2 + 4)
;Local $text = '', $Pid = ShellExecute('schtasks.exe', '/query /fo LIST /tn ' & $CmdLine[1] & ' | findstr /c:"Nächste Laufzeit"', @SystemDir, 'runas')
While 1
$text &= StdoutRead($Pid, False, False)
If @error Then ExitLoop
Sleep(10)
WEnd
$arr = StringSplit($text,": ")
$s = StringRegExpReplace($arr[5], "\r\n|\r|\n", "")
if $s = "Deaktiviert" or $s = "Disabled" Then
$code = "2"
ConsoleWrite($code & " " & $CmdLine[1] & " is disabled ! Please check Task Scheduler")
exit($code)
Else
$code = "0"
ConsoleWrite($code & " " & $CmdLine[1] & " ist aktiv. Alles in Ordnung.")
exit($code)
Endif
Alles anzeigen
Moin,
ich nutze die Funktion ... um einen taskstatus auf dem windows server 2008r2 anzeigen zu lassen.
funktioniert bei mir lokal auf dem win7 rechner super. nur der windows server returned immer 0.
steht schon dabei "only win7 and above" gibt es eine andere möglichkeit die kompatibel ist?
Grüße
TaskScheduler / Aufgabenplaner mittels ObjCreate("Schedule.Service") ansteuern
;==================================================================================
; Function: _TaskIsEnabled($taskname, $folder = "\")
; Description: check if a task is anabled
; Return Value(s): On Success - Return 1 or 0, @ERROR = 0
; On Failure - Sets @ERROR = 1, Return 0
; - Wrong OS (Needs Vista or higher) @Error = 2 Return 0
; Author(s): allow2010
; Based on: http://www.autoit.de/index.php?page=Thread&postID=214517#post214517 and on work from Veronesi
; Note(s): Works only on Win7 and above (Perhaps also Win Vista, but not tested!)
; Thread: http://www.autoitscript.com/forum/topic/135994-taskplanner-udf/
;==================================================================================
Func _TaskIsEnabled($taskname, $folder = "");check if a Task is enabled
If Not _TaskIsValidPlatfrom() Then Return SetError(2, 2, 0)
Local $oService, $oFolder
; $oMyError = ObjEvent("AutoIt.Error", "MyTaskErrFunc") ; Initialize a COM error handler
$oService = ObjCreate("Schedule.Service")
$oService.Connect()
$oFolder = $oService.GetFolder($folder)
If IsObj($oFolder) Then
$oTask = $oFolder.GetTask($taskname)
$instcount = 0
If IsObj($oTask) Then
$retval = $oTask.Enabled
Else
$retval = 0
EndIf
Else
$retval = 0
EndIf
$oService = 0
If $ComErrorFound Then
$ComErrorFound = 0
SetError(1)
Return $retval
Else
Return $retval
EndIf
EndFunc ;==>_TaskIsEnabled
Alles anzeigen