0

Actual i have installed a self hosted agent on my local machine

now my issue is when i am running a release pipeline for a client machine i have a powershell task in which i have a command that runs an exe file located in client machine which displays a message box .

but when I am checking at client machine i am able to see the exe is running in task Manger during the execution of my release pipeline but show how i am not able to see the interface of the application .

Sahil Kandroo
  • 129
  • 1
  • 3
  • 15

1 Answers1

0

You can try adding -Wait to your powershell command. For below example.

Start-Process -FilePath "path to programm.exe" -Wait

You also need to make sure the deployment agent(the agent installed on client machine) is running in interactive mode.

To configure the agent in deployment group to run in interative mode. You need to change the Registration script you copied in azure devops. Remove --runasservice when you run the registration script on the client machine

enter image description here

Then you will be asked to set the agent to run as service or not as below screenshot(Please enter or type N to select interative mode) during the setup.

enter image description here

Check Interactive vs. service for more information.

Levi Lu-MSFT
  • 27,483
  • 2
  • 31
  • 43
  • Thanks for replying , Can you tell me the agent which you are talking about is the agent which I have installed on client machine or the self hosted agent which is installed on my machine And to add my finding on this when the specific power shell task which is running in release pipeline then it is running that exe on client machine in background with system owner and since the client machine is logined in as different user so he is not a able to see the gui of the exe which the power shell has ran – Sahil Kandroo Mar 16 '20 at 12:37
  • You are talking about the self hosted agent by changing its configuration to support interactive mode will that run my exe on client machine? – Sahil Kandroo Mar 16 '20 at 12:50
  • Hi levi I did the step which you have asked me that is remove my self hosted agent and the created a new agent with interactive mode But it didn't resolved my issue I am not able to understand that my problem is during release Pipeline then what it has to do with my build agent to make it interactive . More i didn.t found any interactive type option while deploying the depoyment group script on client machine . I am still stuck in Limbo as far as my issue is concern – Sahil Kandroo Mar 16 '20 at 18:11
  • Hi @SahilKandroo Sorry for the confusion. I didnot know the client machine is in the deployment group. It is the agent that installed on the client machine. For testing, i add set up an interative agent locally to the deployment group of my azure devops organization. I ran `Start-Process -FilePath "path to programm.exe" -Wait`. And the message box appeared successfully. I updated above answer, please check it out. – Levi Lu-MSFT Mar 17 '20 at 07:20
  • Thanks @Lu-MSFT it really worked there is one small issue which I will resolve soon . Only thing is now to run that agent on client machine every time when system is starting which I will take care I really want to thank you big time .you are a champ – Sahil Kandroo Mar 18 '20 at 17:04
  • Hi @SahilKandroo Great to hear it worked. You can add a shortcut of the run.cmd file in folder `C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup` on the client machine. So that the run.cmd will run automatically to start the agent on system startup. And could you accept above as an answer? Thanks. – Levi Lu-MSFT Mar 19 '20 at 02:23
  • Oh thats great but if i add shortcut to the mentioned location then on system start the bat file " run cmd" will run with which user the user which has login the system or by administrator and can i hide this cmd prompt as accidentally cmd can get closed by user. and i will be more than happy to accept above as answer – Sahil Kandroo Mar 19 '20 at 17:15
  • It will run with the login user, you can check out this [thread](https://superuser.com/questions/1168587/how-to-run-an-exe-application-as-a-background-task-on-startup) to minimize the window prompt on start up – Levi Lu-MSFT Mar 20 '20 at 01:57