title: Automated Send Keys Failing When No RDP
body: <p>I have a VM that I wish to run an automated task on (i.e. the automated task runs on the actual VM).</p>
  
  <p>The VM is a Windows 2008 server. </p>
  
  <p>I have added the task into the task scheduler, and when I'm logged into the machine via RDP I can run the task by right clicking, Run.</p>
  
  <p>However, when my RDP session is turned off, (but the user on the VM is still logged in) the task trys to run, but only opens notepad.exe, but does not write the text.</p>
  
  <p>The vbs script is as follows (simplified for our use here...);</p>
  
  <pre><code>Set objShell = WScript.CreateObject("WScript.Shell")
  objShell.Run "Notepad.exe"
  Do Until Success = True
  Success = objShell.AppActivate("Notepad")
  Wscript.Sleep 1000
  Loop
  objShell.SendKeys "This is a test."
  </code></pre>
  
  <p>I have has this task working perfectly on a Windows XP machine and I just cant understand what is causing the issue.</p>
  
  <p>It seems as if there is no keyboard found on the VM when not connected via RDP. When connected via RDP MSTSC sends the VM my keyboard and can then run the task correctly.</p>
  
  <p>Thanks, </p>
  
  <p>David</p>