PowerShell Opens Remote GUI Session for UIAutomation

I am currently working on automatic installation of a GUI application using the UIAutomation PS Extensions library ( https://uiautomation.codeplex.com/ ). It works very well in cases where I run it against an existing Windows user session. I run my PS script, it opens a window, and I can click on the buttons and so on.

However, the problem occurs when this library is called from a remote machine. I invoke my script (which should open the GUI window and start controlling it) through PsExec from a remote machine. This leads to the fact that the script cannot open the GUI window on the remote computer and begins to throw various exceptions.
As a workaround for this, I can get PsExec to connect to a specific existing session on the remote host, but unfortunately this is unstable since I cannot guarantee the existence of the session.

Does enyone know whether it is possible to force PowerShell to open a new session (interactive graphical interface) with which I could invoke UIAutomation commands?

Thanks in advance to Matthew

+7
powershell automation ui-automation psexec microsoft-ui-automation
source share
1 answer

I don’t understand whether it is possible to remotely open a new interactive desktop session where you can run GUI tests that require one. I would be interested to know if this can be done, since such problems often arise when people try to configure CI tests for Windows GUI applications.

Alternatively, I would suggest solving this by setting up the machine on which your tests were run to log in as a user at boot. Then you can remotely run your tests as this user and use their open session. This worked in the past for me when I came across similar problems.

+1
source share

All Articles