window service will not start ui thread / task

This is kinda dumb post.  :) Bamboo running under a window service will not be able to start your UI related task. That's by design. For example, you might want to run an end-to-end specflow task which utilized chrome driver.

And i went through the entire process of using CreateProcessAsUser and CreateProcessWithLogonW which attempts to run a process as a logged on user. CreateProcessWithLogonW is called after i stumble into the following

"If this function fails with ERROR_PRIVILEGE_NOT_HELD (1314), use CreateProcessWithLogonW ". 

End results for this :- the process gets created without any user interface, you can pretty much see it in the background. Wasted at least 16 hours trying to work on this, with the same end results.

It is a fact that you need a user to be logged on to start UI task. So I decided to do something really simple, get a user to login (for example user abc), create a task using task scheduler (yes very lame indeed)  and then creating a script in bamboo to call this task.

This script is really as simple as this.

c:\windows\system32\schtasks.exe /run /tn testapp

And it works. To end this, i use powershell to read test results and returns










Comments

Popular posts from this blog

OpenCover code coverage for .Net Core

ionic2 cordova build android - Unable resolve gradle 2.2.3

Using Custom DLL with IronPython / Scripts