From Remote Desktop Manager v.2024.3 on, the custom installer feature supports the unattended install mode, which allows for automatic installation and configuration. Here is how use this feature :
-
Connect to your Devolutions Account in File – Devolutions Account.
-
Click on Custom installer manager, select Remote Desktop Manager's current version, and check the Encrypt configuration with password in the installer package box.
-
Click on Create.
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.
The script must be run as an administrator, otherwise the UAC prompt cannot appear.
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