Running Robocorp App as a Windows Service

Robocorp Cloud allows you to manage, orchestrate, and schedule the execution of your software robots in a central place. Robocorp Cloud has Processes, which contain steps that Runtime Environments execute.

In this article, we will see how to set up the Robocorp App to run as a background process on a Windows machine.

The primary purpose of running Robocorp App as a service is to essentially set up your machine as a constant Runtime Environment resource just by having the machine powered on.

Prerequisites

  • If you are not familiar with Windows Services this might not be relevant for you.
  • To follow along, you will need a Robocorp Cloud account and Robocorp App. If you haven't already, you might want to follow the Quickstart guide to get familiar with Robocorp Cloud first.
  • You need to have administrator permissions on the machine to set up the service.

Limitations

A Windows Service does not have UI access to applications. This means that you can run so-called headless operations and access the machine and user resources, but you cannot, for example, take screenshots of Windows application UI's.

Set up the user for the service

The setup is simple if you log in to Windows as the user you want the service to run.

Generally, Windows Services can run with different permissions. In RPA cases, the reason for running on local machines is to have access to some user-level resources or permissions, so running the Robocorp App as a Windows Service requires you to use some actual user account that can be logged into.

You can set up a separate local user or use an Active Directory user.

Note: Setting up this user's permissions on the machine with the principle of least privilege is the most effective way of introducing better security.

First, log in to Windows using the account you want the service to run as.

Follow the Robocorp App installation guide, to install and link Robocorp App to your workspace in Robocorp Cloud. Make sure your Robocorp App is correctly linked and able to run:

Robocorp App running

In the Environments page of your workspace in Robocorp Cloud you should now see your Runtime Environment, marked as Idle:

Robocorp App idle

You can now stop Robocorp App as we have verified that the setup has been completed successfully.

Set up Windows Service

Open the settings menu on the Robocorp App UI and select Setup Worker Service...

Robocorp App service setup

You will now have to give the username and password for the service to run as and click Setup. This will create a new Windows Service named robocloud-worker. Creating a service requires administration permissions, and Windows will prompt you on this.

Robocorp App service - Setup user

Once the service setup is done, Robocorp App will enable you to start the service.

Note: To avoid confusion, the Robocorp App does not allow you to simultaneously run a it as a service and on the UI. This is why the console is not visible, and you can only issue Start Worker Service and Stop Worker Service commands.

You can now Start Worker Service, which again is a command that requires administrator permissions.

Robocorp App service - Setup done

If the service started successfully, the UI should now look like this.

Note: The most common cause for service start failure is an invalid password. Currently, the only way to recover from this is to remove the service and redo the steps (improvements coming to this).

You can also check the service setup details via the Windows Services tool Start menu -> Services.

Windows Services

We are done! Now Robocorp App service will automatically start when the machine is powered up.

Stopping the service temporarily

When Robocorp App is running as a service, you can stop it from the UI. Take note that the Robocorp App service is set to start after reboot automatically, so if you restart your machine, the service will start.

Robocorp App service - Stop

Removing the service

To remove the service from your machine, you need to Stop Worker Service if it is running and select Remove Worker Service... from the settings menu.

Robocorp App service - Remove

Robocorp App service - Verify removal