Get-UIaWindow failed to get active iexplore window when launched from mstask



Microsoft Windows Server 2003 R2 Enterprise x64 Edition + Internet Explorer 8

When I run the powerscript from a task scheduled in mstask, an InternetExplorer window is opened in background with "Start-Process iexplore" but Get-UIaWindow did not find this window, except when the user is already logged.

Because of a bug found in the Perl Module Win32::ActAcc which is no more maintained, I am trying to rewrite under Powershell a Perl script which runs scenarios on Internet Explorer window in background tasks without logged user.

Is there any way to deal with background window with UIAutomation ?


apetrovskiy wrote Mar 24, 2014 at 10:31 AM

I have never heard whether MSAA could work without a user session (why do screen readers and magnifiers support a session nothing is visible in?). If so, MSAA is a subset of UIAutomation ("UI Automation providers offer some support for Microsoft Active Accessibility client applications, through a built-in bridging service.") and the parts Microsoft adopted don't work without a user session.

Anyway, MSAA is left only for compatibility and is partially supported on Windows 8+.

I could suggest three ways:
1) use MSAA via COM interfaces
2) use tools that partially work in background (they create a limited user session what might be enough for not very heavy-loaded with controls applications and web pages) - RemCom/PaExec/PsExec
3) if your pages don't use ssl (https), why you need to click if you can send HTTP requests? For example, by catching them via WireShark or Fiddler, modifying and using in tests.

PORCHEROT wrote Mar 24, 2014 at 4:50 PM


I have already created a Perl script to send HTTPS requests, but the scenario is sometimes very difficult to reproduce with some sites, especially because of the multiple existing types of authentification.

I tried PaExec, without specifying host, user and password (so using the credencials of the launching user), and UIautomation is working nice in background with it.

Thank you for your quick answer, and I am now very impatient to work with the next versions of UIautomation.

Best regards