> 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/shell-script-vpn.md).

# Custom VPN (CMD)

Configure the Custom VPN (CMD) entry in Remote Desktop Manager, including the executable, opening and closing arguments, credentials, and VPN settings.

This article details the many settings and options available for ***Custom VPN (CMD)*** VPN entries in Remote Desktop Manager. This entry starts an executable or script of your choice to open the VPN connection, and runs it again with different arguments to close it.

{% hint style="info" %}
The ***Host*** field of the ***Connection*** tab is disabled when the host comes from the ***Host*** setting above the tabs instead of being configured in the entry. In the same way, the ***Username***, ***Domain***, and ***Password*** fields are disabled when the credentials are not configured in the entry.
{% endhint %}

<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 is displayed. <em><strong>External</strong></em> is the only display mode available for this entry. The lists next to it set the monitor and the virtual desktop.</td></tr><tr><td><strong>Host</strong></td><td>Where the host of the VPN comes from. Select whether the host is configured in the entry, linked to a host entry, or inherited from a parent folder.</td></tr><tr><td><strong>Credentials</strong></td><td>Where the credentials used by the VPN come from. Select whether the credentials are configured in the entry, linked to a credential entry, or obtained another way.</td></tr><tr><td><strong>VPN type</strong></td><td>The type of VPN the entry opens. Set to <em><strong>Shell script</strong></em> for this entry. Changing it switches the entry to another VPN type and changes the content of the <em><strong>Connection</strong></em> tab.</td></tr></tbody></table>

### Connection

<table><thead><tr><th width="220">SETTINGS</th><th>DESCRIPTION</th></tr></thead><tbody><tr><td><strong>Host</strong></td><td>The host name or IP address of the VPN server. This field is required unless the host comes from a host entry.</td></tr><tr><td><strong>Executable</strong></td><td>The executable or script launched to open and close the VPN. Click the ellipsis button to browse for the file. This field is required, and the file must exist.</td></tr><tr><td><strong>Opening arguments</strong></td><td>The arguments passed to the executable when the VPN is opened.</td></tr><tr><td><strong>Closing arguments</strong></td><td>The arguments passed to the executable when the VPN is closed.</td></tr><tr><td><strong>Wait interval (sec)</strong></td><td>The number of seconds to wait for the VPN client to start after the executable is launched, between 0 and 999999. The wait is skipped when <em><strong>Wait for exit</strong></em> is enabled.</td></tr><tr><td><strong>Run in background</strong></td><td>Run the executable in a hidden window when opening and closing the VPN.</td></tr><tr><td><strong>Wait for exit</strong></td><td>Wait for the executable to exit before continuing, instead of waiting for the <em><strong>Wait interval</strong></em>.</td></tr><tr><td><strong>Use taskkill to close the VPN</strong></td><td>Close the VPN by ending the running processes that have the same name as the executable, instead of running the executable with the <em><strong>Closing arguments</strong></em>.</td></tr><tr><td colspan="2"><strong>Credentials</strong></td></tr><tr><td><strong>Username</strong></td><td>The username used to connect to the VPN.</td></tr><tr><td><strong>Domain</strong></td><td>The domain of the VPN account.</td></tr><tr><td><strong>Password</strong></td><td>The password used to connect to the VPN. This field is disabled when the <em><strong>Disable password saving in vaults</strong></em> system setting is enabled.</td></tr></tbody></table>

The following variables can be used in the opening and closing arguments: `$VPN_USERNAME$`, `$VPN_DOMAIN$`, `$VPN_HOST$`, and `$VPN_PASSWORD$`.

### VPN settings

<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 once the VPN is connected.</td></tr><tr><td><strong>Close connection after (min)</strong></td><td>Close the VPN automatically after the set number of minutes, between 0 and 4320.</td></tr><tr><td><strong>Detect reachable host in wait</strong></td><td>While waiting for the VPN to connect, check whether the host can be reached, so the wait can end as soon as it can.</td></tr><tr><td><strong>VPN reconnect mode</strong></td><td><p>Choose what happens to the VPN when a session that uses it is reconnected:</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>Switch Remote Desktop Manager back to online mode the set number of seconds after the VPN is disconnected, between 0 and 180.</td></tr><tr><td><strong>Use adapter to detect connection</strong></td><td>Use the network adapter to detect whether the VPN connection is open.</td></tr><tr><td><strong>After execution, wait</strong></td><td><p>Choose how Remote Desktop Manager waits after the VPN is started:</p><ul><li><strong>Delay</strong> — Wait the set number of seconds, between -1 and 180.</li><li><strong>For IP on adapter</strong> — Wait for the network adapter to receive an IP address. Enter the adapter name or device name, or click the browse button to select it. Set <em><strong>Wait a maximum of</strong></em> (in seconds, between -1 and 180) and <em><strong>Then delay</strong></em> (in milliseconds, between -1 and 180000).</li></ul></td></tr><tr><td colspan="2"><strong>Commands</strong></td></tr><tr><td colspan="2">The settings of this section 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>Commands</strong></td><td>The list of VPN commands, showing each command's <em><strong>Name</strong></em>, <em><strong>After connection command</strong></em>, and <em><strong>Before disconnecting command</strong></em>. Use the toolbar to add, edit, delete, move up, or move down a command.</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 commands together in a batch. This option 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/shell-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.
