I have a VM that I wish to run an automated task on (i.e. the automated task runs on the actual VM).
The VM is a Windows 2008 server.
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.
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.
The vbs script is as follows (simplified for our use here...);
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."
I have has this task working perfectly on a Windows XP machine and I just cant understand what is causing the issue.
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.
Thanks,
David