Rumdada Posted March 31, 2021 Share Posted March 31, 2021 Hi all very new to AutoIT so I wrote up a small script to open a program, enter a password, submit and close the program. The script works 100% when I execute it on the local pc. I am unable to get it to run when attempting it remotely. I use psexec and the .exe can be seen in the task manager on the target machine but it just stays there forever. Any Ideas as to whats going on? Here is the .au3 script ; Script Start - ShellExecute("D:\One\onemore\config\blah\blah.exe") AutoItSetOption('MouseCoordMode', 0) WinWait(Program – Some Program') WinActivate(Program – Some Program') MouseClick('primary', 153, 195, 1, 0) Send('password') MouseClick('primary', 294, 196, 1, 0) WinWait(Program – Some Program) MouseClick('primary', 634, 13, 1, 0) Link to comment Share on other sites More sharing options...
Nine Posted March 31, 2021 Share Posted March 31, 2021 Probably the winwait is waiting forever. Put a timeout to see if this is the case, and an error handling after to ensure you got it right. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Rumdada Posted March 31, 2021 Author Share Posted March 31, 2021 1 minute ago, Nine said: Probably the winwait is waiting forever. Put a timeout to see if this is the case, and an error handling after to ensure you got it right. Ill give that a whirl, how would I do the error handling? Link to comment Share on other sites More sharing options...
Nine Posted March 31, 2021 Share Posted March 31, 2021 See WinWait in help file to grab the return value (if 0 then time-out)... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Rumdada Posted March 31, 2021 Author Share Posted March 31, 2021 (edited) Ok I updated the script with timeouts and it works locally. When I attempt to run via ansible using the win_psexec module(interactively or not) I get a false positive. I know its not working because when you submit the last click its supposed to make a log entry to show a successful login. Any ideas? Updated au3 ShellExecute("D:\One\Onemore \config\blah\blah.exe") AutoItSetOption('MouseCoordMode', 0) WinWait("[CLASS:someprogram]", "", 5) WinActivate(someprogram) MouseClick('primary', 153, 195, 1, 0) Send('password') MouseClick('primary', 294, 196, 1, 0) WinWait("[CLASS:someprogram]", "", 5) MouseClick('primary', 634, 13, 1, 0) Edited March 31, 2021 by Jos added codebox Link to comment Share on other sites More sharing options...
Gianni Posted March 31, 2021 Share Posted March 31, 2021 I don't know if you have already done this, but do you use the -i parameter in the psexec command which starts your executable? Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Rumdada Posted March 31, 2021 Author Share Posted March 31, 2021 Yes here is my playbook for ansible, return code 0 and it says it’s a success but a false positive due to there begin no long entry on the program. --- - hosts: all gather_facts: yes tasks: - name: Execute ODT HeartbeatTest win_psexec: command: D:\Blah.exe \i elevated: yes Link to comment Share on other sites More sharing options...
NitroMatt Posted March 23, 2022 Share Posted March 23, 2022 Did you end up getting this working? Having exactly the same issue, can see the application installer has started in TaskManager, but the installer UI doesn't appear. Running the AutoIT generated .exe manually and it runs fine. Link to comment Share on other sites More sharing options...
spudw2k Posted March 23, 2022 Share Posted March 23, 2022 @NitroMatt Does your application installer support silent installation? If you can run it where it doesn't require interaction would be best (if the UI) isn't displayed, or if you are scripting the install, using ControlClick functions may be more reliable. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
NitroMatt Posted March 23, 2022 Share Posted March 23, 2022 It doesn't unfortunately, AutoIT was a last resort to package this particular app. Manually running the complied .exe and it runs as expected, the application installs as per the steps in the .au3 file I built. Problem seems to be invoking the complied installer via Ansible. Can see the compiled installer and the application installer are running in task manager when the required Ansible command runs, just no UI appears so the application install never finishes. In Ansible have tried win_shell and win_command. Also tried calling the compiled .exe from a PowerShell script and from a .bat but no joy. Link to comment Share on other sites More sharing options...
spudw2k Posted March 24, 2022 Share Posted March 24, 2022 What does your AutoIt script look like which automates the installer? Can you share it? Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
rudi Posted April 7, 2022 Share Posted April 7, 2022 the "interactive" switch for PSEXEC is "/i" not "\i" iirc ... On 3/31/2021 at 10:25 PM, Rumdada said: command: D:\Blah.exe \i elevated: yes Maybe this article of Marc Russinovich https://www.itprotoday.com/windows-server/psexec-explainer-mark-russinovich might be of some help? I'd like to mention to populate your autoit script with local log file writing to see, what's going on: expandcollapse popup#include <Date.au3> $Counter = 0 $LOG="C:\temp\my-log-file.txt" $hLOG=FileOpen($LOG,2+8) $hLOG=FileWriteLine($hLOG,@ScriptFullPath) $Counter+=1 ;some lines of code Sleep(2000) FileWriteLine($hLOG,"Log " & $Counter & @TAB & _NowCalc() & @TAB & @UserName & "\" & @LogonDomain & "@" & @ComputerName) $Counter+=1 ;some lines of code Sleep(2000) FileWriteLine($hLOG,"Log " & $Counter & @TAB & _NowCalc() & @TAB & @UserName & "\" & @LogonDomain & "@" & @ComputerName) $Counter+=1 ;some lines of code Sleep(2000) FileWriteLine($hLOG,"Log " & $Counter & @TAB & _NowCalc() & @TAB & @UserName & "\" & @LogonDomain & "@" & @ComputerName) $Counter+=1 ;some lines of code Sleep(2000) FileWriteLine($hLOG,"Log " & $Counter & @TAB & _NowCalc() & @TAB & @UserName & "\" & @LogonDomain & "@" & @ComputerName) $Counter+=1 ;some lines of code FileWriteLine($hLOG,"Log " & $Counter & @TAB & _NowCalc() & @TAB & @UserName & "\" & @LogonDomain & "@" & @ComputerName) $Counter+=1 Sleep(1000);some lines of code FileWriteLine($hLOG,"Log " & $Counter & @TAB & _NowCalc() & @TAB & @UserName & "\" & @LogonDomain & "@" & @ComputerName) $Counter+=1 Sleep(5000);some lines of code FileWriteLine($hLOG,"Log " & $Counter & @TAB & _NowCalc() & @TAB & @UserName & "\" & @LogonDomain & "@" & @ComputerName) FileWriteLine($hLOG,"------- EOF -----------") FileClose($hLOG) assuming that you have a folder named "C:\TEMP" on the destination system, and the compiled script is on your local machine at c:\temp\Logging-sample.exe, run PSEXEC using this line: psexec \\REMOTEHOSTNAME -ih -c c:\temp\Logging-sample.exe -w c:\temp PsExec v2.2 - Execute processes remotely Copyright (C) 2001-2016 Mark Russinovich Sysinternals - www.sysinternals.com Logging-sample.exe exited on wx-0111 with error code 0. At the local console of the remote machine follow up the process and the content of the log file: C:\WINDOWS\system32>tasklist /fi "imagename eq logging-sample.exe" Abbildname PID Sitzungsname Sitz.-Nr. Speichernutzung ========================= ======== ================ =========== =============== Logging-sample.exe 81752 Console 1 10.704 K C:\WINDOWS\system32>tasklist /fi "imagename eq logging-sample.exe" INFORMATION: Es werden keine Aufgaben mit den angegebenen Kriterien ausgeführt. C:\WINDOWS\system32>cd \temp C:\temp>start .\my-log-file.txt Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now