wxfield Posted May 28, 2009 Posted May 28, 2009 Hello, I read the FAQs and have not come to any useful conclusions about this problem, so here it is... We have created a fairly simple AutoIT script that (when executed) will start an InstallShield Installer and handle it. The process works perfectly if you were to execute the AutoIT exe manually. The problem comes when we try to schedule it. If we use the windows 'AT' command to schedule it, the job executes and appears in the Tasklist. However the two processes (the AutoIT exe and the InstallShield exe) appear to just 'hang' in the process list. We logged each step in the AutoIT exe and we know that the AutoIT script is waiting indefinitely for the first window on the InstallShield app to appear. It might be interesting to note that we also tried using psexec to accomplish the same thing (psexec replacing the 'at' scheduler), and we got exactly the same results. Coming from a *nix background I have a theory that maybe I'm not running in a session that allows AutoIT to perform normally. All these processes are run as Administrator incidentally.
evilertoaster Posted May 28, 2009 Posted May 28, 2009 If you're scripting a GUI you'll want to make sure you run the task as interactive (/INTERACTIVE i think...) or it won't be able to access the GUI.
wxfield Posted May 28, 2009 Author Posted May 28, 2009 If you're scripting a GUI you'll want to make sure you run the task as interactive (/INTERACTIVE i think...) or it won't be able to access the GUI.Tried that..same result. I wonder if (since I'm executing the AutoIT exe as /INTERACTIVE) the AutoIT exe must get also instantiate the InstallShield app similarly?Is that even possible?
PsaltyDS Posted May 28, 2009 Posted May 28, 2009 Tried that..same result. I wonder if (since I'm executing the AutoIT exe as /INTERACTIVE) the AutoIT exe must get also instantiate the InstallShield app similarly?Is that even possible?I would recommend the following: 1. Dump AT.exe. Use SchTasks.exe to create and manage tasks, not the depricated AT.exe command.2. If you ever open an AT job in Task Scheduler, it is converted automatically to a SchTasks job and can no longer be managed by AT.exe. In the process, some options, like "/interactive" may get dropped. SchTasks uses the same job objects Task Scheduler does, so it avoids the issue.3. Don't run the .exe file directly. Make your command line for the task something like 'START "C:\Full\Path\SomeName.cmd"', and have that batch file run your .exe. This causes a shell environment with system environment variables and drive mappings to be created for the job. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
wxfield Posted May 29, 2009 Author Posted May 29, 2009 I would recommend the following: 1. Dump AT.exe. Use SchTasks.exe to create and manage tasks, not the depricated AT.exe command. 2. If you ever open an AT job in Task Scheduler, it is converted automatically to a SchTasks job and can no longer be managed by AT.exe. In the process, some options, like "/interactive" may get dropped. SchTasks uses the same job objects Task Scheduler does, so it avoids the issue. 3. Don't run the .exe file directly. Make your command line for the task something like 'START "C:\Full\Path\SomeName.cmd"', and have that batch file run your .exe. This causes a shell environment with system environment variables and drive mappings to be created for the job. I made the batch file. I tested it as Administrator and it runs as expected in the logged-in environment. However when I schedule it, it fails to run. With 'at' I saw it appear in the tasklist, but with this facility, I get nada. schtasks /Create /IT /SC ONCE /TN uninstall /TR "C:\sb\testing\uninstall.bat" /ST 10:53 SUCCESS: The scheduled task "uninstall" has successfully been created. C:\sb\testing\automation\perl\tests\iSCSI\HITKit\HIT Installer>schtasks /Query TaskName Next Run Time Status ==================================== ======================== =============== uninstall 10:53:00 AM, 5/29/2009 And at 10:54.. C:\sb\testing\automation\perl\tests\iSCSI\HITKit\HIT Installer>schtasks /Query TaskName Next Run Time Status ==================================== ======================== =============== uninstall Never Could not start
PsaltyDS Posted May 29, 2009 Posted May 29, 2009 I made the batch file. I tested it as Administrator and it runs as expected in the logged-in environment. However when I schedule it, it fails to run. With 'at' I saw it appear in the tasklist, but with this facility, I get nada.schtasks /Create /IT /SC ONCE /TN uninstall /TR "C:\sb\testing\uninstall.bat" /ST 10:53SUCCESS: The scheduled task "uninstall" has successfully been created.C:\sb\testing\automation\perl\tests\iSCSI\HITKit\HIT Installer>schtasks /QueryTaskName Next Run Time Status==================================== ======================== ===============uninstall 10:53:00 AM, 5/29/2009And at 10:54..C:\sb\testing\automation\perl\tests\iSCSI\HITKit\HIT Installer>schtasks /QueryTaskName Next Run Time Status==================================== ======================== ===============uninstall Never Could not startYou have to specify the "/RU UserName" and "/RP PassWord" parameters to match the logged in user for "/IT" to work. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
wxfield Posted May 29, 2009 Author Posted May 29, 2009 You have to specify the "/RU UserName" and "/RP PassWord" parameters to match the logged in user for "/IT" to work. schtasks prompted me for usr/pass before queueing...so i figured it was ok to omit..but i tried /RU /RP to see what would happen anyway..C:\>schtasks /Create /IT /SC ONCE /TN uninstall /TR "C:\sb\testing\uninstall.bat" /ST 11:22 /RU Administrator /RP automation /ZSUCCESS: The scheduled task "uninstall" has successfully been created.C:\>timeThe current time is: 11:21:16.01Enter the new time:C:\>schtasks /QueryTaskName Next Run Time Status==================================== ======================== ===============uninstall 11:22:00 AM, 5/29/2009C:\>timeThe current time is: 11:22:16.34Enter the new time:C:\>schtasks /QueryTaskName Next Run Time Status==================================== ======================== ===============uninstall Never Could not startComing from a 20+ year *nix background, may I say this is dang frustrating?
PsaltyDS Posted May 29, 2009 Posted May 29, 2009 (edited) schtasks prompted me for usr/pass before queueing...so i figured it was ok to omit..but i tried /RU /RP to see what would happen anyway..C:\>schtasks /Create /IT /SC ONCE /TN uninstall /TR "C:\sb\testing\uninstall.bat" /ST 11:22 /RU Administrator /RP automation /ZSUCCESS: The scheduled task "uninstall" has successfully been created.C:\>timeThe current time is: 11:21:16.01Enter the new time:C:\>schtasks /QueryTaskName Next Run Time Status==================================== ======================== ===============uninstall 11:22:00 AM, 5/29/2009C:\>timeThe current time is: 11:22:16.34Enter the new time:C:\>schtasks /QueryTaskName Next Run Time Status==================================== ======================== ===============uninstall Never Could not startTry changing the target command line to: /TR "START C:\sb\testing\uninstall.bat"Coming from a 20+ year *nix background, may I say this is dang frustrating? You may, and Amen to that! Edited May 29, 2009 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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