> 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/rdm/knowledge-base/knowledge-base-articles/entry-settings/powershell-script-vpn.md).

# Custom VPN (PowerShell)

Configure Custom VPN (PowerShell) entries in Remote Desktop Manager, including connect and disconnect scripts, credentials, parameters, and VPN settings.

This article details the many settings and options available for ***Custom VPN (PowerShell)*** VPN entries in Remote Desktop Manager.

<table data-header-hidden><thead><tr><th width="200"></th><th></th></tr></thead><tbody><tr><td><strong>SETTINGS</strong></td><td><strong>DESCRIPTION</strong></td></tr><tr><td><strong>Name</strong></td><td>The name of the entry.</td></tr><tr><td><strong>Folder</strong></td><td>The folder where the entry is located.</td></tr><tr><td><strong>Display</strong></td><td>How the entry opens. VPN entries open as <em><strong>External</strong></em>, and the list cannot be changed.</td></tr><tr><td><strong>Host</strong></td><td>Where the host of the entry comes from. Select a host mode from the list. When the host does not come from the entry itself, the <em><strong>Host</strong></em> field of the <em><strong>Credentials</strong></em> tab is unavailable.</td></tr><tr><td><strong>Credentials</strong></td><td>How the credentials of the entry are provided. Select a credential mode from the list. When the credentials do not come from the entry itself, the <em><strong>Username</strong></em>, <em><strong>Domain</strong></em>, and <em><strong>Password</strong></em> fields of the <em><strong>Credentials</strong></em> tab are unavailable.</td></tr><tr><td><strong>VPN type</strong></td><td>The type of VPN of the entry. <em><strong>PowerShell script</strong></em> is selected for this entry. Selecting another type replaces the settings of the <em><strong>Connection</strong></em> tab.</td></tr></tbody></table>

### Connection

**Connect**

<table><thead><tr><th width="220">SETTINGS</th><th>DESCRIPTION</th></tr></thead><tbody><tr><td><strong>Connect mode</strong></td><td><p>Select what runs to connect the VPN:</p><ul><li><strong>PowerShell</strong> — run the script entered in the script editor. Click <em><strong>Edit</strong></em> to open the script in a separate editor. The <em><strong>Edit</strong></em> button is not supported on Linux.</li><li><strong>Link</strong> — run a PowerShell entry or a PowerShell session tool selected from the list. A linked entry is required.</li></ul></td></tr></tbody></table>

**Disconnect**

<table><thead><tr><th width="220">SETTINGS</th><th>DESCRIPTION</th></tr></thead><tbody><tr><td><strong>Connect mode</strong></td><td><p>Select what runs to disconnect the VPN:</p><ul><li><strong>PowerShell</strong> — run the script entered in the script editor. Click <em><strong>Edit</strong></em> to open the script in a separate editor. The <em><strong>Edit</strong></em> button is not supported on Linux.</li><li><strong>Link</strong> — run a PowerShell entry or a PowerShell session tool selected from the list. A linked entry is required.</li></ul></td></tr></tbody></table>

**Credentials**

<table><thead><tr><th width="220">SETTINGS</th><th>DESCRIPTION</th></tr></thead><tbody><tr><td><strong>Host</strong></td><td>The host of the VPN. Type <code>$VPN_HOST$</code> in a parameter to use this value.</td></tr><tr><td><strong>Username</strong></td><td>The username of the VPN. Type <code>$VPN_USERNAME$</code> in a parameter to use this value.</td></tr><tr><td><strong>Domain</strong></td><td>The domain of the VPN. Type <code>$VPN_DOMAIN$</code> in a parameter to use this value.</td></tr><tr><td><strong>Password</strong></td><td>The password of the VPN. Type <code>$VPN_PASSWORD$</code> in a parameter to use this value. Unavailable when a policy disables password saving in vaults.</td></tr></tbody></table>

**Parameters**

<table><thead><tr><th width="220">SETTINGS</th><th>DESCRIPTION</th></tr></thead><tbody><tr><td><strong>Parameter #1</strong> to <strong>Parameter #5</strong></td><td>Up to five values to pass to the scripts. In a script, type <code>$PARAMETER1$</code> for the first parameter, <code>$PARAMETER2$</code> for the second, and so on.</td></tr></tbody></table>

**Advanced**

<table><thead><tr><th width="220">SETTINGS</th><th>DESCRIPTION</th></tr></thead><tbody><tr><td><strong>Wait interval (sec)</strong></td><td>The number of seconds to wait, from 0 to 999999.</td></tr><tr><td><strong>Run as administrator</strong></td><td>Run the script with administrator privileges.</td></tr><tr><td><strong>Run in background</strong></td><td>Run the script in the background.</td></tr><tr><td><strong>Wait for exit</strong></td><td>Wait for the script to exit.</td></tr></tbody></table>

### Advanced

<table><thead><tr><th width="220">SETTINGS</th><th>DESCRIPTION</th></tr></thead><tbody><tr><td><strong>Go offline on connection</strong></td><td>Switch Remote Desktop Manager to offline mode when the VPN connects.</td></tr><tr><td><strong>Close connection after (min)</strong></td><td>Select the check box to close the VPN automatically after the set number of minutes, from 0 to 4320. The value is available when the check box is selected.</td></tr><tr><td><strong>Detect reachable host in wait</strong></td><td>While waiting for the VPN, detect whether the host can already be reached.</td></tr><tr><td><strong>VPN reconnect mode</strong></td><td><p>Select the reconnect behavior of the VPN:</p><ul><li><strong>Default</strong></li><li><strong>Reconnect VPN</strong></li><li><strong>Leave VPN open</strong></li></ul></td></tr><tr><td><strong>Go online on disconnect after (sec)</strong></td><td>Select the check box to switch Remote Desktop Manager back to online mode the set number of seconds after the VPN disconnects, from 0 to 180.</td></tr><tr><td><strong>Use adapter to detect connection</strong></td><td>Use the network adapter to detect whether the VPN is connected.</td></tr></tbody></table>

**After execution, wait**

<table><thead><tr><th width="220">SETTINGS</th><th>DESCRIPTION</th></tr></thead><tbody><tr><td><strong>After execution, wait</strong></td><td><p>Select what Remote Desktop Manager waits for after the VPN is started:</p><ul><li><strong>Delay</strong> — wait the set number of seconds, from -1 to 180.</li><li><strong>For IP on adapter</strong> — wait for the network adapter to receive an IP address. Enter the adapter name or the device name, or leave the field blank. Click the browse button to select an adapter.</li></ul></td></tr><tr><td><strong>Wait a maximum of (sec)</strong></td><td>The maximum time to wait for the IP address, from -1 to 180 seconds. Visible when <em><strong>For IP on adapter</strong></em> is selected.</td></tr><tr><td><strong>Then delay (ms)</strong></td><td>An additional delay once the IP address is received, from -1 to 180000 milliseconds. Visible when <em><strong>For IP on adapter</strong></em> is selected.</td></tr></tbody></table>

**Commands**

<table><thead><tr><th width="220">SETTINGS</th><th>DESCRIPTION</th></tr></thead><tbody><tr><td><strong>Commands</strong></td><td>The list of VPN commands, with their <em><strong>Name</strong></em>, <em><strong>After connection command</strong></em>, and <em><strong>Before disconnecting command</strong></em>. Use the <em><strong>Add</strong></em>, <em><strong>Edit</strong></em>, <em><strong>Delete</strong></em>, <em><strong>Move up</strong></em>, and <em><strong>Move down</strong></em> buttons to manage the list. The commands are available only when <em><strong>After execution, wait</strong></em> is set to <em><strong>For IP on adapter</strong></em>, and are not supported on macOS.</td></tr><tr><td><strong>After connecting, VPN command enabled</strong></td><td>Run the after connection commands once the VPN is connected.</td></tr><tr><td><strong>Before disconnecting, VPN command enabled</strong></td><td>Run the before disconnecting commands before the VPN is disconnected.</td></tr><tr><td><strong>Run routes in batch (forces elevated privileges)</strong></td><td>Run the route commands together in a batch. This requires elevated privileges.</td></tr></tbody></table>


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.devolutions.net/rdm/knowledge-base/knowledge-base-articles/entry-settings/powershell-script-vpn.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
