> 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/how-to-articles/use-the-custom-installer-in-unattended-setups.md).

# Use the custom installer in unattended setups

Generate a custom Remote Desktop Manager installer package and deploy it silently using a PowerShell unattended setup script.

The custom installer feature supports the unattended install mode, which allows for automatic installation and configuration. Here is how use this feature :

### Generating a custom installer package

1. Connect to your ***Devolutions Account*** in ***File*** – ***Devolutions Account***.
2. Click on ***custom installer manager***, select Remote Desktop Manager's current version, and check the ***Encrypt configuration with password in the installer package*** box.
3. Click on **Create**.

### Installing the custom installer package

The following PowerShell script automatically installs the previously generated package and injects the password. Note that the password injection only occurs if you have checked the ***Encrypt configuration with password in the installer package*** box in step 2.

{% hint style="info" %}
The script must be run as an administrator, otherwise the UAC prompt cannot appear.
{% endhint %}

Here is the full script to save in .ps1 format:

```
param (
    [Parameter(Mandatory = $true, Position = 0, HelpMessage = "Path to MSI for Remote Desktop Manager")]
    [ValidateNotNullOrEmpty()]
    [string]
    $MsiPath,
    [switch]
    $AskPassword,
    [parameter(ValueFromPipeline)][string]$password
)
function Read-Password {
    param (
        [string]$Prompt = "Enter Password"
    )
    if ($password) {
        $securePassword = ConvertTo-SecureString -AsPlainText -Force $password
    }
    else {
        $securePassword = Read-Host -AsSecureString -Prompt $Prompt
    }
    $password = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto(
        [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($securePassword)
    )
    return $password
}
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
if (!$currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
    Write-Warning "Not running as administrator. You may run into issues"
}
& 'msiexec.exe' /i "${MsiPath}" /qn
if ($AskPassword) {
    $password = Read-Password
    $pipeHandle = [System.IO.Pipes.NamedPipeClientStream]::new('.', 'DevolutionsUpdater', [System.IO.Pipes.PipeDirection]::Out)
    try {
        $pipeHandle.Connect(15000)
        $passwordBytes = [System.Text.Encoding]::UTF8.GetBytes($password)
        $pipeHandle.Write($passwordBytes, 0, $passwordBytes.Length)
        $pipeHandle.Flush()
    }
    catch {
        Write-Error "Failed to connect to installer instance. Is the installer running with administrator or is RDM already installed?"
    }
    finally {
        $pipeHandle.Close()
    }
}
```

When installing the package, it is important to provide the password securely. To achieve this, use a named pipe to prevent the password from being written to the disk or logged.

To run the script:

```
PS C:\WINDOWS\system32> . '<Path to above shown .ps1 script>' '<Path to RDM msi>' -AskPassword
```

To pipe the password from an environment variable:

```
PS C:\WINDOWS\system32> echo $env:MY_PASSWORD | & 'C:\Temp\RdmInstall.ps1' 'C:\Temp\Setup.RemoteDesktopManager.2024.3.0.0.msi' -AskPassword
```

#### See also

* [Devolutions Academy - How to Use the Custom Installer](https://academy.devolutions.net/student/page/2397676-how-to-use-the-custom-installer?sid=2202ce15-ae72-4051-b6d9-0a203c58d229\&sid_i=0)


---

# 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/how-to-articles/use-the-custom-installer-in-unattended-setups.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.
