title: Running AutoIt script using psexec
body: <p>I am trying to automate installation of an exe file on remote systems. My AutoIt script automates the installation. If I run this script from the system where I need to install, everything works fine.</p>
  
  <p>Problem occurs when I initiate the script from a remote machine. The exe starts but it does not function (wait for the window to appear, then send <kbd>Enter</kbd>, etc.). My AutoIt script:</p>
  
  <pre><code>Run("setup.exe")
  WinWaitActive("Installation Wizard")
  Send("{ENTER}")
  WinWaitActive("Installation Wizard")
  Sleep(1000)
  Send("{TAB}")
  Sleep(1000)
  Send("data")
  Sleep(1000)
  Send("{TAB}")
  Sleep(1000)
  Send("{ENTER}")
  </code></pre>
  
  <p>I am using the exe generated from the au3 file from a batch file to be run on the remote machine. Batch file:</p>
  
  <pre><code>PsExec.exe \\host -u &lt;user&gt; -p &lt;pass&gt; -i &lt;session id&gt; "&lt;path to batch&gt;\autoitinstall.bat"
  </code></pre>
  
  <p>Giving the session id as above resolves the issue of window not opening. But once I minimize the RDP window the window becomes inactive. How can I make sure that the setup.exe window is active all the time in the remote system (even if I minimize the RDP window)?</p>
  
  <p>Batch file on remote system:</p>
  
  <pre><code>cd /d &lt;path to the exe generated from au3 file&gt;
  start autoitinstall.exe
  </code></pre>