PowerShell打开UIAutomation的远程GUI会话

时间:2015-04-23 19:07:37

标签: powershell automation ui-automation psexec microsoft-ui-automation

我目前正在使用库UIAutomation PS Extensions(https://uiautomation.codeplex.com/)自动安装GUI应用程序。当我针对现有的Windows用户会话运行它时,它的效果非常好。我运行我的PS脚本,它打开一个窗口,我可以点击按钮等等..

但是,从远程计算机调用此库时会出现问题。我通过PsExec从远程机器调用我的脚本(应该打开一个GUI窗口并开始控制它)。这导致脚本无法在远程计算机上打开GUI窗口并开始产生各种异常。
作为解决方法,我可以使PsExec连接到远程主机上的特定现有会话,但不幸的是这不稳定,因为我无法保证会话的存在。

enyone是否知道是否可以强制PowerShell打开新会话(交互式GUI),通过它我可以调用UIAutomation命令?

提前感谢 马修

1 个答案:

答案 0 :(得分:1)

I'm not clear on whether it's feasible to remotely open a new interactive desktop session in which to run GUI tests that require one. I'd be interested to find out if it's doable, since problems like this frequently come up when folks try to set up CI tests of Windows GUI apps.

Alternatively, I'd propose solving this by configuring the machine where your tests run to log in as a user at boot. Then you can remotely launch your tests as that user, and make use of their open session. That's worked in the past for me when I've run into similar issues.