Is there anyway to remote stop/start the BOTs especially when we have many BOTs and if there is a maintenance or something, we need to login to each BOT and execute start/stop of BOT. We have already tried the start and stop commands remotely which are not working as we expected.
For example, we used ShutdownRuntime.exe for stopping the bot using remote powershell command with BOT user account. It is not doing graceful shutdown instead killing the runtime process and locking the operator id.
For BOT start we use "C:\Program Files (x86)\OpenSpan\OpenSpan Runtime Enterprise\OpenSpan.Runtime.exe" workgroup=<WG name>. It starts a runtime process without any user even though we provide the user on remote command.
Please read my post carefully. I didnt ask for BOT start/stop script which I know already. I am trying to remote start/stop which is different. The command executes but as interactively as BOT user account.
1) Implement a graceful shutdown of the runtime. There are many ways to do it - starting from manually exiting the runtime (if unplanned maintenance) to building in self-shutdown based on operating hours sourced from a config file where you can add maintenance parameters. You can test the advice in this post for a parameter in the remoted shutdown command as well. The graceful shutdown is important because it sends the "sign off" command from bot to Robot Manager so that it knows the Operator ID is no longer available for work.
2) If you absolutely cannot design a graceful shutdown, then there is still a way to kill remotely (I believe this is what you are trying) or even just reboot the VDI remotely. We don't recommend that because if your bot was in the middle of processing a work assignment, then this case is going to be left in unknown state. Still, if you perform an unexpected shutdown, you can leverage pzProcessStaleRobots agent (or underlying pzCleanUpStaleRoboticOperators activity on-demand) to reset Operator ID. You will need this step because otherwise Operator IDs won't be available for runtimes to re-register).
3) Implement auto-logon for bot machines with automatic trigger for a runtime start in any way that is acceptable in your environment - could as straightforward as through Windows registry (but you will have to have bot password saved in the registry) or through RPA Scheduling service. This step must occur after Operator IDs are appropriately reset (either due to graceful shutdown or clean up activity in the platform).
If these steps are planned out and executed correctly, then you can minimize manual administrative effort for a large bot farm.
There is processExitTimeout argument for ShutdownRuntime.exe that sets timeout in milliseconds before Runtime is killed. Combine this together with the following parameter in RuntimeConfig.xml and see if it helps to shutdown gracefully in your case:
<!-- Specifies if Runtime will wait for all automations to complete before terminating. Values: "Immediate", "WaitForAutomations" -->
<!-- Immediate - Stop proceeds without waiting for automations to complete -->
<!-- WaitForAutomations - Stop will not proceed until all automations have completed. -->