让虚拟机认为鼠标在移动

Making a VM think a mouse is moving

我希望使用大约一个小时后进入挂起模式的 VMware Horizo​​n VM 作为我构建的几个 Azure 应用程序的本地网关。我不想更改 VM 所在池的电源策略。我的想法是构建一个 VB 脚本,该脚本会在 VM 中每 10-20 分钟模拟一次鼠标 movement/key 划动以保持它进入挂起模式并将网关置于在线状态。我可以作为起点使用示例 VB 脚本的任何方向?

您也许可以简单地使用 WScript Shell 打开记事本并发送几个键:

Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.Run "%windir%\notepad.exe"
WshShell.AppActivate "Notepad"

WshShell.SendKeys "Stay Awake: " & Now
WshShell.SendKeys "{ENTER}"

这应该能让事情继续下去。也许您可以使用相同的方法在应用程序之间简单地使用 Alt-Tab:

WshShell.SendKeys "&{TAB}"