# Run as a service on Windows

The easiest way to have the extension started automatically as a service is to create a task in Windows Task scheduler. The trigger of the task must be configured to “System boot” and it is best run under System Credentials. Below the steps to follow.

Follow this video for a full tutorial:

{% embed url="<https://www.youtube.com/watch?v=eBEZjBWQX6E>" fullWidth="true" %}
Video guide on how to run extension as a service in Windows
{% endembed %}

**1. Start windows Task Scheduler**

<figure><img src="https://content.gitbook.com/content/6yVPUWGXrvCkUcDV7WOV/blobs/dZfOQmdMlFhV0dteuISZ/image.png" alt=""><figcaption></figcaption></figure>

**2. Create a new task**

<figure><img src="https://content.gitbook.com/content/6yVPUWGXrvCkUcDV7WOV/blobs/RKyDf6XwYXlLS7HTm03i/image.png" alt=""><figcaption></figcaption></figure>

**3. Enter the general task information**

<figure><img src="https://content.gitbook.com/content/6yVPUWGXrvCkUcDV7WOV/blobs/S0LxDzKwnXj20XvJm8RK/image.png" alt=""><figcaption></figcaption></figure>

* Name the task with a reference to the extension, you will start with this task
* Set SYSTEM user account to execute this task. It is important to use an account with privileges to start services
* Check what version suits your system best (Windows Server)

**4. Set trigger for the task to be executed**

<figure><img src="https://content.gitbook.com/content/6yVPUWGXrvCkUcDV7WOV/blobs/FQve6np2MOR4i24iMHRP/image.png" alt=""><figcaption></figcaption></figure>

* Add a new `trigger` on the TASK pane.
* Select the trigger “At Startup”.
* Make sure the trigger is enabled.

**5. Set the action to start the program**

<figure><img src="https://content.gitbook.com/content/6yVPUWGXrvCkUcDV7WOV/blobs/PeYpk4OAYOUzLEVZI84N/image.png" alt=""><figcaption></figcaption></figure>

* On the `Actions` tab select `New…`
* Set your action to type `Start program`
* Select the binary file of your extension as the `Program`. In this example it is `C:\SuperTables\super-tables-win.exe”`. Make sure to include the entire path.
* *Optional when using ``config.yml`:``* Set your Arguments for the extension server (port number and certificate details).\
  In this example: `--port 443 --cert certificate.crt --key certificate.key` (double dashes without space in between)
* Set the `Start in` folder. This is very important for the service to start correctly. It is the path where the binary file/program is located. In this example: `C:\SuperTables`
* Press OK to store your `Action`.

**6. Set proper conditions for task**

<figure><img src="https://content.gitbook.com/content/6yVPUWGXrvCkUcDV7WOV/blobs/AxacetAH4EtF5DfXWGPj/image.png" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Make sure the task will always be executed (battery or AC power)!
{% endhint %}

**7. Set extra settings**

<figure><img src="https://content.gitbook.com/content/6yVPUWGXrvCkUcDV7WOV/blobs/uBhKmVmB4n4VSkKgbc6j/image.png" alt=""><figcaption></figcaption></figure>

* Make sure the task will remain running.
* Make sure the task can be started on demand.
* Make sure the task will restart automatically on failure.

**8.Manually start the task**

<figure><img src="https://content.gitbook.com/content/6yVPUWGXrvCkUcDV7WOV/blobs/mpM5c6PDv1nXgSq04ngJ/image.png" alt=""><figcaption></figcaption></figure>

* Once you saved the newly created task select it in the list of tasks
* Click the `Run` button on the right panel to start the new tas
* The status of the service will change from `Ready` to `Running` just like the ShowMeMore task in the screenshot.
