Bootstrap portable Remote Desktop Manager version

Sometimes, users lack the privilege to install Remote Desktop Manager on their machine. This obstacle can be circumvented by installing a portable version of Remote Desktop Manager and relying on an environment variable to set the path to the required .NET runtime.

Note that this method is not fully tested and may be unstable as a result.

Here are the steps:

  1. Download the zipped .NET runtime and .NET Windows Desktop runtime. These are not available on Microsoft's download page, rather they need to be downloaded via the official project releases.
  2. Extract the runtime archives into the same directory.
  3. Set the environment variable DOTNET_ROOT to point to the extracted .NET runtime directory.
  4. Launch RemoteDesktopManager.exe with the environment variable properly set (from the same terminal/prompt).

Here is a simple script to set it up automatically, only the .NET runtime, .NET Windows Desktop runtime, and destination folder must be provided:

function BootstrapPortableRDM {
    <#
    .SYNOPSIS
        Bootstrap a portable installation of RDM 2024.x
    .DESCRIPTION
        You must provide the zipped .NET Runtime and .NET Windows Desktop Runtime. The
        zip releases are not available on the Microsoft download page but can be found
        in the project releases at https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/8.0/releases.json.
        Additionally you must provide the zipped Remote Desktop Manager and a location to
        create the portable package root.
        A launch script will be generated in the packaged `RDM` directory.
    .EXAMPLE
        $PackageRoot=Join-Path $Env:USERPROFILE "portable"
        ./setup-environment.ps1 -DotNetRuntimeArchiveFilePath "dotnet-runtime-8.0.4-win-x64.zip" -DotNetDesktopRuntimeArchiveFilePath "windowsdesktop-runtime-8.0.4-win-x64.zip" -RemoteDesktopManagerArchiveFilePath "Devolutions.RemoteDesktopManager.Bin.2024.1.25.0.zip" -PackageRootDirectory $PackageRoot
        & $(Join-Path $PackageRoot "RDM/launch-rdm.ps1")
    #>
    param(
        [Parameter(Mandatory, HelpMessage="The .NET Runtime .zip archive")]
        [string] $DotNetRuntimeArchiveFilePath,

        [Parameter(Mandatory, HelpMessage="The .NET Windows Desktop Runtime .zip archive")]
        [string] $DotNetDesktopRuntimeArchiveFilePath,

        [Parameter(Mandatory, HelpMessage="The Remote Desktop Manager .zip archive")]
        [string] $RemoteDesktopManagerArchiveFilePath,

        [Parameter(Mandatory, HelpMessage="The root packaging folder")]
        [string] $PackageRootDirectory
    )

    $ErrorActionPreference = "stop"

    $DotNetRuntimeArchiveFilePath = Resolve-Path $DotNetRuntimeArchiveFilePath
    $DotNetDesktopRuntimeArchiveFilePath= Resolve-Path $DotNetDesktopRuntimeArchiveFilePath
    $RemoteDesktopManagerArchiveFilePath= Resolve-Path $RemoteDesktopManagerArchiveFilePath

    New-Item -Path $PackageRootDirectory -Type Directory -Force
    Push-Location $PackageRootDirectory

    Expand-Archive $RemoteDesktopManagerArchiveFilePath -DestinationPath "RDM"
    Expand-Archive $DotNetRuntimeArchiveFilePath -DestinationPath "dotnet"
    Expand-Archive $DotNetDesktopRuntimeArchiveFilePath -DestinationPath "dotnet"

    $LaunchScript = @'
$DotNetRoot = Join-Path $(Get-Item $PSScriptRoot).Parent.FullName "dotnet"
$Env:DOTNET_ROOT=$DotNetRoot
$RdmDir = Join-Path $(Get-Item $PSScriptRoot).Parent.FullName "RDM"
$Rdm = Join-Path $RdmDir "RemoteDesktopManager.exe"
& "$Rdm"
'@
    $LaunchScript | Out-File $(Join-Path RDM "launch-rdm.ps1")

    Pop-Location
}

BootstrapPortableRDM @args

 

Devolutions Forum logo Give us Feedback