title: Automating user interaction from within Session 0
body: <p>I am running on Windows Server 2012. I have a service that creates several processes, one of them is a GUI client. The process in high level is as follows:</p>
  
  <ol>
  <li>Service runs a launcher exe </li>
  <li>The launcher exe launches an AutoIT compiled exe</li>
  <li>The AutoIT compiled exe launches a winform exe</li>
  </ol>
  
  <p>The winform exe does two things:
  a. It write a file to the disk on program startup (test.log)
  b. It waits for a keyboard press "c" to write a second file to the disk (test2.log)</p>
  
  <p>The AutoIT script does two things:
  a. It launches the said winform exe
  b. It sleeps for 5 seconds and then send "c" (Send command)</p>
  
  <p>If I start running this chain manually (from step 2) - everything works fine and 2 files are being created. I guess this happens because I have an interactive session (specifically 2) so it's a no brainer here. However, if I run it from the service, everything runs in session 0 (I verified this with ProcessExplorer) but only the first file is being written. Meaning, the keystroke message was not read by the winform exe.</p>
  
  <p>I read about Session 0 isolation which means that user input from other sessions can't interact with programs (services) running in session 0. However, all of the processes mentioned now run in the same session 0. So I'm not sure why my application doesn't get the keyboard strokes? Any workaround for this? Please note that running under a different session is probably not possible, as the server must run without user logged on and as far as I know, you can't launch a session yourself without logging into the system.</p>
  
  <p>Any help is appreciated.
  Thanks!</p>