Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

Start application as specific user



  • Hello all,

    I would like to start an WPF application that has to run in foreground with GUI after deployment under Windows.

    I have tried to achieve it starting it from a *.bat file with "Execute command line" action.
    Example of *.bat content:
    start notepad++.exe
    exit /b
    The application was started in a back-ground and the execution plan was not finishing, it got stuck after the process of the application was started. And BM was logging the stdout of it.
    Then I tried to start the application with "Execute PowerShell Script" action.
    Example:
    Start-Processnotepad++.exe
    The deployment was successful but the process was again in the background because its owner was SYSTEM.

    Then i tried to start it with a different user as follows:

    $username = 'myAdmin'
    $password = 'myPlainTextPassword
    $securePassword = ConvertTo-SecureString $password -AsPlainText -Force
    $credential = New-Object System.Management.Automation.PSCredential $username, $securePassword
    Start-Process Notepad.exe -Credential $credential

    But this time I received an error:
    This command cannot be run due to the error: Access is denied.

    Could you please give me some guidelines on how to start a WPF application with GUI as a foreground process as a part of a deployment plan?

    Best regards,
    Stoyan Kostov

    Product: BuildMaster
    Version: 6.0.6



  • I am not aware of any good way to interact with the GUI while running as a service, at least not since Windows Vista.

    There is "Kiosk Mode", is that what you're looking for?



  • Hello Tod,

    Thank you very much for the answer but I don't need "Kiosk Mode".
    What I'm trying to achieve is to start my application using the deployment plan by some kind of command. So later the administrator can interact with it though its GUI. Currently I'm deploying the application to few servers. The goal is not to open the application manually after the deployment. I want the launching of my application to be done by Build Master. The application is written in C#, Windows Presentation Foundation.

    Best regards,
    Stoyan Kostov



  • Stoyan -- this is really no way of doing this on Windows. It's simply a limitation of the operation system, and has been for over 10 years. You cannot have something that runs under a service context (BuildMaster and Inedo Agents run as a service) interact with the desktop UI in anyway.

    You cannot "escape" a service context in any way. So from within a service, you can't launch a program that launches a program that launches a program etc., that launches a WPF application.

    You would, instead, need to write a desktop application that monitors "something" (a drop folder, pipe, etc), and then reacts when that that changes.


Log in to reply
 

Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation