> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/powershell/devolutions-gateway-powershell/powershell-auto-updater-script-for-devolutions-gateway.md).

# PowerShell auto-updater script for Devolutions Gateway

This PowerShell script is meant to be registered as a scheduled task that runs once a day to check for updates, download and then install them. This script is especially useful when using multiple gateways as it saves a lot of time.

{% hint style="info" %}
Read this [GitHub](https://github.com/Devolutions/devolutions-gateway/blob/master/tools/updater/README.md) page for more details.
{% endhint %}

### Installing

1. Download the auto-updater [PowerShell script](https://github.com/Devolutions/devolutions-gateway/blob/master/tools/updater/GatewayUpdater.ps1).
2. Open an elevated PowerShell terminal.
3. Move to the directory containing the GatewayUpdater.ps1 script.
4. Run it using the `install` parameter.

```powershell
PS > .\GatewayUpdater.ps1 install

TaskPath                                       TaskName                          State
--------                                       --------                          -----
\                                              Devolutions Gateway Updater       Ready
Updater script installed to 'C:\Program Files\Devolutions\Gateway Updater\GatewayUpdater.ps1' and registered as 'Devolutions Gateway Updater' scheduled task
```

### Running

By default, the scheduled task will run every day at 3AM. It can also be manually triggered by using the following command: `& schtasks.exe /Run /TN "Devolutions Gateway Updater"`\
The status of the scheduled task can then be queried:

```powershell
PS > schtasks.exe /Query /TN "Devolutions Gateway Updater"

Folder: \
TaskName                                 Next Run Time          Status
======================================== ====================== ===============
Devolutions Gateway Updater              Date     3:00:00 AM    Ready
```

{% hint style="info" %}
The updater automatically downloads the installer if there is a new version is available, then checks the file hash before running it silently.
{% endhint %}

### Uninstalling

{% hint style="info" %}
This will unregister the scheduled task and delete the GatewayUpdater.ps1 script from the path used in the command.
{% endhint %}

1. Open a PowerShell terminal.
2. Run the GatewayUpdater.ps1 script with the `uninstall` parameter.

```powershell
PS > .\GatewayUpdater.ps1 uninstall

Folder: \
TaskName                                 Next Run Time          Status
======================================== ====================== ===============
Devolutions Gateway Updater              Date     3:00:00 AM    Ready
SUCCESS: The scheduled task "Devolutions Gateway Updater" was successfully deleted.
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.devolutions.net/powershell/devolutions-gateway-powershell/powershell-auto-updater-script-for-devolutions-gateway.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
