Note that there are some explanatory texts on larger screens.

plurals
  1. POCreate and immediately run a Windows task once (as admin)
    primarykey
    data
    text
    <p>I'm setting up a test node for a continuous integration server. It shall perform the GUI tests of the application. Therefore it gets the generated setup package and silently installs the application before running the other interactive tests. There is one problem though: UAC.</p> <p>Since we don't want to disable UAC to maintain a realistic test environment, it needs to be bypassed once to setup the application. There are a number of ways to do that, a popular one seems to use the Windows task scheduler for that. Tasks can be added as normal user and configured to run as administrator with no further confirmation. I could use the <code>schtasks /create</code> command for that but its parameters are unclear. Also, the parameter values in the <code>/?</code> help seem to be translated into German on my system and I believe (and hope) that this is a bug and the values shall actually be specified in English.</p> <p>Also, I only want to create the task to have it executed immediately once, then delete it and continue with my other activities (all in a batch file). How would a schtasks call look like for this? I'd start with something like this, but it's incomplete:</p> <pre><code>schtasks /create /tn "Testaufgabe" /tr "setup.exe" /sc EINMAL /it /np /z /rl /f </code></pre> <p>PS: Oh, and I need to wait until the started application has finished until I can continue with other tasks. So the program invokation must be synchronous, not in the background. I've searched the web for hours now but can't seem to find a way to accomplish this. UAC just seems to be unusable for this scenario. But we need it in the test case because that's what the user will have.</p> <p>Update: You can't use the Task Scheduler API to register tasks that will run with highest privileges. This is only possible if you have admin privileges at the time creating the task, which is not useful in my situation. So I think I need to use schtasks.exe specifically.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload