I have a .vbs which interact with an application window (Microsoft SQL Management Express Studio) by checking and selecting app options (refreshing, executing a command and closing).

If I execute this .vbs it works fine.
If I execute a schedule task with logged off session, it doesn't work.

I have confirmed .vbs is being executed, but it does not interact with the application. I think it's window is losing the focus. How could I focus / bring on top this application window?

I have tried the following, but is not working:

Set objIE=CreateObject("Microsoft SQL Management Express Studio.Application")

Set WSHShell = WScript.CreateObject("WScript.Shell")
WSHShell.AppActivate("Microsoft SQL Management Express Studio.Application")

Any idea?

Thanks in advance.