Quantcast
Viewing latest article 17
Browse Latest Browse All 33

New Post: UIautomation: cannot contol GUI on a remote PC

I am trying to control on my local PC a remote application that is running on a remote PC.

The following code is working when controlling the same application locally.

Get-UiaWindow -Class 'Window' -Name 'Archiver Collector Tool' |Get-UiaButton -AutomationId '_startButton' -Class 'Button' -Name 'Start'| Invoke-UiaButtonClick

But when trying to run it through invoke command on an open session (New-PSSession) it does not work.

Invoke-Command -Session $job {Import-Module "C:\UIAutomation\UIAutomation.dll" ; Get-UiaWindow -Class 'Window' -Name 'Archiver Collector Tool'| get-UiaButton -AutomationId '_startButton' -Class 'Button' -Name 'Start'| Get-UiaText -Class 'TextBlock' -Name 'Start'}

Following error is seen.

_Failed to get window in 5000 milliseconds by: process name: '', process Id: , window title: 'Archiver Collector Tool', automationId: '', className: 'Window'.
+ CategoryInfo          : InvalidResult: (:) [Get-UiaWindow], Exception
+ FullyQualifiedErrorId : FailedToGetWindow,UIAutomation.Commands.GetUiaWindowCommand
+ PSComputerName        : remotePC

Viewing latest article 17
Browse Latest Browse All 33

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>