Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/22/2022 in all areas

  1. i was able to find a video from 2016 that answered the majority of my continued issues, along with some additional things i though were useful. i then found a stack overflow page that answered the rest of my issues. the following are my findings. # open new tab instead of new window check.if.already.open=1 # default linewrap wrap=0 # default statusbar visibility statusbar.visible=1 # clears output window before executing clear.before.execute=1 # default output window location. 0=bottom, 1=side output.initial.hide=0 # at open, load previously open files from close save.session=1 # set defualt zoom level magnification=1 # set default directory to last opened script open.dialog.in.file.directory=1 # show line numbers line.margin.visible=1
    1 point
  2. But, he cant delete your quote. /edit, doh, guess you meant he should delete it on GH, not here, it was fun for a minute though. 😛
    1 point
  3. taskkill /s remoteServer  /u userName /FI "IMAGENAME eq filename" Something to that extent can remotely kill the process if you have admin rights You can use Autoit to create a nice GUI so they can supply the credentials, but it can easily be done just in .bat file as well. Then on the remote machine, use Autoit to create some kind of Daemon that checks if the process is running and if not restarts it. Better yet, find a way to completely resolve the issue on the local machine rather than needing any remote interaction at all. Look at things like what changes when its in the "crashed" state, what kind of breadcrumb can you follow, like CPU usage, RAM usage, A service not responding, etc. ....and of course if you can get to the root cause and prevent it from crashing at all, that would be most ideal. Here is something I wrote for the helpdesk to restart the print spooler for a users computer that lets them use an AD search to find the computer and remotely restart the service. #Include <AD.au3> #Include <File.au3> #include <Constants.au3> #include <StaticConstants.au3> #include <ExtMsgBox.au3> #include <Array.au3> #include <Services.au3> HotKeySet("{ESC}", "_Terminate") ;Set ESC Key to Force Exit Program If Remote Computer Hangs Global $sINI = @ScriptDir & "\Config_StartServiceRemote.ini" If NOT FileExists($sINI) Then ;See if our configuration file exist, if not create it IniWrite($sINI, "CONFIG", "RemoteService", "spooler") IniWrite($sINI, "CONFIG", "ShowSplash", "1") IniWrite($sINI, "CONFIG", "Debug", "0") EndIf Global $iDebug = INIRead($sINI, "CONFIG", "Debug", "0") ; Set 0 for Normal Operation, Set 1 to See Debug Information Global $sService = INIRead($sINI, "CONFIG", "RemoteService", "spooler") ;Global Varible for Service we want to work with Global $iSplash = INIRead($sINI, "CONFIG", "ShowSplash", "1") ;Global Varible to Show or Hide Status Messages 0 Off 1 On $sPCN = InputBox("IIO Automation - Find Computer By PCN", "Input PCN To Search For", "") ;Ask user to input a PCN Value If @Error = 1 Then Exit $sResult = "" _AD_Open() ;Open Connection To AD GLOBAL $sOU = "OU=*snip*" ;Define a Specific OU To Search In GLOBAL $aObjects[0][0] ;Define The Array To Store Results $aObjects = _AD_GetObjectsInOU("", "(&(objectclass=computer)(sAMAccountName=*" & $sPCN & "*))", 2, "sAMAccountName") ;AD Query Searching for Computers and A Description Starting With X If @error > 0 Then ;If We Have No Results MsgBox(64, "Active Directory", "No Results Found or Bad Query") ;Show Error Message Exit Else For $i = 1 To $aObjects[0] $aObjects[$i] = StringTrimRight($aObjects[$i], 1) Next EndIf _AD_Close() ;Close Connection to AD If $aObjects[0] > 3 Then $aObjects[0] = 4 ;If element count is more than 4 than it will be reduced to only 4 If $iDebug = 1 then _ArrayDisplay($aObjects) $sObjects = _ArrayToString($aObjects, "|", 1, $aObjects[0]) ;This moves the array into a string for use as buttons; uses the element count to determin how many buttons If $iDebug =1 Then MsgBox("Show Array", "", $sObjects) _ExtMsgBoxSet(1, 2, 0x004080, 0xFFFF00, 10, "Comic Sans MS", 1000, 1200) ;Set our message box global style $sMsg = "Click The Computer You Want To Connect To" $iRetValue = _ExtMsgBox($EMB_ICONEXCLAM, $sObjects, "Found Computers by PCN", $sMsg, 0) If @Error Then MsgBox(0, "There Was An Error Code Returned", @Error) ConsoleWrite("Test 3 returned: " & $iRetValue & @CRLF) If $iRetValue = 0 Then Exit ; Reset to default _ExtMsgBoxSet(Default) If $iDebug = 1 Then MsgBox(0, "Computer Chosen", $aObjects[$iRetValue]) TCPStartup() $sComputerName = $aObjects[$iRetValue] $sComputerIP = TCPNameToIP($aObjects[$iRetValue]) TCPShutdown() If $iDebug = 1 Then MsgBox(0, "Computer IP", $sComputerIP) ;Returns Are $aObjects[$iRetValue] for Computer Name and $sComputerIP for IP Address $aStatus = _Service_QueryStatus($sService, $sComputerName) If $iDebug = 1 Then _ArrayDisplay($aStatus) If $aStatus[1] = $SERVICE_RUNNING Then $iResponce = MsgBox($MB_YESNO, "IIO Automation", "Service " & $sService & " Is Already Running" & @CRLF & "Try To Restart?") If $iResponce = $IDYES Then _RestartServiceX() Else Exit EndIf EndIf _StartServiceX() Func _RestartServiceX() _Service_Stop($sService, $sComputerName) If $iSplash =1 Then SplashTextOn("IIO Automation", "Stopping " & $sService & " Service" & @CRLF & "Press Escape To Cancel", 500, 100) Do Sleep(100) $aStatus = _Service_QueryStatus($sService, $sComputerName) Until $aStatus[1] = $SERVICE_STOPPED SplashOff() ;_StartServiceX() EndFunc Func _StartServiceX() _Service_Start($sService, $sComputerName) If $iSplash = 1 Then SplashTextOn("IIO Automation", "Starting " & $sService & " Service" & @CRLF & "Press Escape To Cancel", 500, 100) Do Sleep(100) $aStatus = _Service_QueryStatus($sService, $sComputerName) Until $aStatus[1] = $SERVICE_RUNNING SplashOff() MsgBox($MB_OK, "IIO Automation", $sService & " Service Has Been Started on " & $sComputerName) Exit EndFunc Func _Terminate() Exit EndFunc
    1 point
  4. Considering your post count, you'll probably know the following info already . Furthermore, this has been mentioned numerous times in this and other threads. Just in case it has escaped your attention until now, here is a brief summary (simplified) : Compile your scripts in a3x format instead of exe. To execute a3x scripts on the target machine, there are several ways, e.g. : Install AutoIt, then you can execute a3x scripts similar to .exe by double-clicking. However, this option is often not desired by the recipient. If the scripts should only run on your own computer this is irrelevant, because an AutoIt installation already exists. Copy the appropriate file(s) AutoIt3.exe or AutoIt3_x64.exe to the target computer. Associate the extension a3x with the interpreter (AutoIt3.exe). Execution of a3x scripts by double-clicking possible. Since this requires a change in the registry of the target computer, it may also be undesirable. Copy the appropriate file(s) AutoIt3.exe or AutoIt3_x64.exe to the target computer. a3x files can be executed e.g. via a .cmd or a shortcut. This is the least invasive variant. I have switched all my scripts to the a3x format and since then virtually no problems with virus software anymore . Regarding security : au3 scripts will be embedded as a3x when compiling an .exe, so there are no differences. ==> Definitely worth a look is the solution from @Exit , see : au3tocmd-avoid-false-positives
    1 point
  5. Nice , and here's it all glued together. #include <Array.au3> $aWinList = WinList("[REGEXPCLASS:(Explore|Cabinet)WClass]") For $i = 1 To UBound($aWinList) - 1 $aSelection = _WindowsExplorer_ExtractSelectedDirAndFiles($aWinList[$i][1]) _ArrayDisplay($aSelection, "Explorer Instance #" & $i & " / " & WinGetTitle($aWinList[$i][1])) Next ; =================================================================================================================== ; Name...........: _WindowsExplorer_ExtractSelectedDirAndFiles ; Description....: Function to extract LocationURL and selected files from a "Windows Explorer" Window ; Syntax.........: _WindowsExplorer_ExtractSelectedDirAndFiles($hWnd) ; Parameters.....: $hWnd - Windows handle of an "Windows Explorer" Window ; AutoIt Version.: 3.3.6.1 ; Return values..: Success - Array ; Array[0] = Number of files selected in right-hand Listview ; Array[1] = LocationURL - selected in left-hand Treeview or Window Rebar ; Array[2] - Array[n] = URL of selected files in right-hand Listview ; Failure - Array ; Array[0] = 0 ; Array[1] = "" ; Sets the @error flag to non-zero. ; @error = 1 - $hwnd is not a valid window handle ; @error = 2 - $hwnd is not a window handle for an "Windows Explorer" Window ; @error = 3 - "Shell.Application" object could not be created ; @error = 4 - "$oShellApp.Windows()" object could not be created ; Author.........: Ascend4nt, KaFu, klaus.s ; =================================================================================================================== Func _WindowsExplorer_ExtractSelectedDirAndFiles($hWnd) Local $aExplorerSelectedFiles[2] = [0, ""] If Not IsHWnd($hWnd) Then Return SetError(1, 0, $aExplorerSelectedFiles) Local $aWinList = WinList("[REGEXPCLASS:(Explore|Cabinet)WClass]") While 1 For $i = 1 To UBound($aWinList) - 1 If $hWnd = $aWinList[$i][1] Then ExitLoop 2 Next Return SetError(2, 0, $aExplorerSelectedFiles) WEnd Local $oShellApp = ObjCreate("Shell.Application") If Not IsObj($oShellApp) Then Return SetError(3, 0, $aExplorerSelectedFiles) Local $oShellApp_Windows = $oShellApp.Windows() If Not IsObj($oShellApp_Windows) Then Return SetError(4, 0, $aExplorerSelectedFiles) For $oShellApp_Inst In $oShellApp_Windows If $oShellApp_Inst.hwnd = $hWnd Then ExitLoop Next Local $oShellApp_Inst_SelectedItems_Count = $oShellApp_Inst.document.SelectedItems.Count Local $oShellApp_Inst_LocationURL = $oShellApp_Inst.LocationURL Local $aHexCodes = StringRegExp($oShellApp_Inst_LocationURL, '%([[:xdigit:]]{2})', 3) If Not @error Then ; Change all the '%xx' values into ';'s (invalid path character) $oShellApp_Inst_LocationURL = StringRegExpReplace($oShellApp_Inst_LocationURL, '%([[:xdigit:]]{2})', ';') ; Then go through 1 by 1 and replace each ';' in left-to-right order (same as array order) For $i = 0 To UBound($aHexCodes) - 1 $oShellApp_Inst_LocationURL = StringReplace($oShellApp_Inst_LocationURL, ';', ChrW('0x' & $aHexCodes[$i]), 1) ; only the 1st occurrence for each rep! Next EndIf $oShellApp_Inst_LocationURL = StringReplace($oShellApp_Inst_LocationURL, 'file:///', '') $aExplorerSelectedFiles[0] = $oShellApp_Inst_SelectedItems_Count $aExplorerSelectedFiles[1] = StringReplace($oShellApp_Inst_LocationURL, '/', '\') ReDim $aExplorerSelectedFiles[$aExplorerSelectedFiles[0] + 2] $oShellApp_Inst_SelectedItems = $oShellApp_Inst.document.SelectedItems Local $iCounter = 2 For $oShellApp_Inst_SelectedItem In $oShellApp_Inst_SelectedItems $aExplorerSelectedFiles[$iCounter] = $oShellApp_Inst_SelectedItem.path $iCounter += 1 Next $oShellApp = 0 $oShellApp_Windows = 0 Return $aExplorerSelectedFiles EndFunc ;==>_WindowsExplorer_ExtractSelectedDirAndFiles
    1 point
×
×
  • Create New...