The Report Viewer Multi-User Installation

The Report Viewer in Citrix and Other Multi-User Systems

The Report Viewer is a standalone Windows desktop application.  If the prerequisites exist, it can run without being installed.

Install Loop

But, if you run the installer as one user, such as the computers administrator, you have to run the installer as each user.  Otherwise you my encounter an install-loop.  Each user that tries to run the software, without having installed it, will get an installer that displays.  This will never complete, because the under-privileged user doesn't have access to the installer.

Solution

If you run the installer as the administrator, you have to run it for each user.

To make sure the software is installed for each user, you can use the below PowerShell.  That script will check if the software is installed.  If it is not installed, it will install the software in passive mode.

Running the Install Check

You have the following options to run the install-check:

  1. Using Group Policy:
    1. Open the "Local Group Policy Editor" (you can do this by running gpedit.msc).
    2. Navigate to Computer Configuration -> Windows Settings -> Scripts -> Logon.
    3. Add your script to the list of scripts to run at logon.
  2. Using Task Scheduler:
    1. Open "Task Scheduler".
    2. Click "Create Task...".
    3. On the "General" tab, name your task, and set "Security options" to "Run with highest privileges".
    4. On the "Triggers" tab, click "New..." and set "Begin the task" to "At log on".
    5. On the "Actions" tab, click "New..." and set "Action" to "Start a program", then browse to your script file.
    6. Click "OK" to create the task.

Running the Install Check using Task Scheduler In-depth

  1. Save the PowerShell Script: Save the provided PowerShell script to a location accessible by all users, such as C:\scripts\install_app.ps1.
  2. Open Task Scheduler: Press Windows + R, type taskschd.msc, and press Enter.
  3. Create a New Task: In the Actions pane on the right, click "Create Task..."
  4. Set Name and Security Options: In the "General" tab, give the task a name, such as "Install App". In the "Security options" section, select "Run with highest privileges" and ensure the task is configured to run for the user who is logged on.
  5. Set Trigger: Go to the "Triggers" tab, click "New...", and set "Begin the task" to "At log on". In the "Advanced settings" section, check "Delay task for" and set it to 30 seconds (or longer if needed). This ensures that the script will run after the user has logged in.
  6. Set Action: Go to the "Actions" tab, click "New...", and set "Action" to "Start a program". In the "Program/script" field, type powershell.exe. In the "Add arguments (optional)" field, type -ExecutionPolicy Bypass -File "C:\scripts\install_app.ps1" (replace the path with the actual path to your script).
  7. Configure Conditions and Settings: In the "Conditions" and "Settings" tabs, you can configure additional options like running the task only if the computer is idle, stopping the task if it runs too long, etc. Configure these options as needed.
  8. Save and Close: Click "OK" to save and close the new task.
  9. Test the Task: You can test the task by logging out and logging back in or by selecting the task in Task Scheduler and clicking "Run".

PowerShell Script to Check TRV is Installed for Citrix User

The below code should be saved as a .ps1 filetype.

Edit the code to use the actual path to the rv.msi installer.

################################################################################
# T H E   R E P O R T   V I E W E R   U S E R   I N S T A L L   C H E C K
# Use this script to install The Report Viewer software in multi-user
#   environments.  The Report Viewer is a Windows desktop application that
#   is designed to be installed on a per-user basis.  This script will
#   install for each user, if it is not already installed.
# First you want to install the softwares prerequisites, which are:
#   - .Net Framework 4.7.2 or later
#   - The Crystal Reports runtime redistributable for the version, which is
#       included in the installer.  It is version specific, so you need to
#       install the version that matches the version of The Report Viewer that
#       you are installing.
# Second, install The Report Viewer on an administrator account.
# Third, copy this script to a location that all users can access and run it.
# Run this scritp on startup, using the Task Scheduler, or group policy.
# Doing this will complete the installation for the user.
# For complete information, see the documention titled "The Report Viewer
#   User Install Check" at https://www.thereportviewer.com/user-install-check
#   and the document titled "The Report Viewer Multi-User Installation" at
#   https://www.thereportviewer.com/multi-user-installation.
################################################################################

################################################################################
# I N S T R U C T I O N S
# Edit the variables below to match your environment.
# Set tab spaces to 4.
#
# The installer path.  Set this to actual path of the installer.
#   This is the path to the rv.msi file.
#   This file path should be in a location that is accessable by all users.
#   A network share is a good location, because this is designed for mulit-user
#   environments.
$INSTALLER_PATH = "C:\Users\TRV Testing\Documents\trv_installer\trv\rv.msi"
# The software version... This is placeholder text that you will need to change.
$SOFTWARE_VERSION = "9.1.8.0"
################################################################################

################################################################################
# DO NOT MODIFY ANYTHING BELOW THIS LINE
################################################################################

# The company name... DO NOT MODIFY THIS.  This folder is distict from the one
#   that Windows automatically creates and manages, which contains underscores
#   instead of spaces.
$companyName = "Report Viewer Limited"

# Set the installer path and installation marker file path
$installMarkerFolderPath = "$env:AppData\${companyName}"
$installMarkerFilePath = "$installMarkerFolderPath\version_$SOFTWARE_VERSION.txt"

# Check if the marker file exists
if (-not (Test-Path $installMarkerFilePath)) {
    try {
        # Check if the installer exists
        if (Test-Path $INSTALLERPATH) {

            # Install the software
            #Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"$INSTALLER_PATH`" /passive" -Wait

            # Requires .Net Framework System.Diagnostics
            # Install the software, because Start-Process doesn't return
            #   an exit code, which is required to determine if the
            #   installation was successful.
            $process = New-Object System.Diagnostics.Process
            $process.StartInfo.FileName = "msiexec.exe"
            $process.StartInfo.Arguments = "/i `"$INSTALLER_PATH`" /passive"
            $process.StartInfo.RedirectStandardOutput = $true
            $process.StartInfo.UseShellExecute = $false
            $process.Start()

            $process.WaitForExit()

            # Check if the installation was successful
            if ($process.ExitCode -eq 0) {

                # Create the installation marker __folder__ if it doesn't exist
                #   already... a bit redundent, but it's better to be safe
                if (-not (Test-Path $installMarkerFolderPath)) {
                    New-Item -Path $installMarkerFolderPath -ItemType Directory -Force
                }

                # Create the installation marker __file__
                New-Item -Path "${installMarkerFilePath}" -ItemType File -Force

            } else {
                Write-Host "Installation failed with exit code: $LASTEXITCODE"
            }

        } else {
            Write-Host "Installer not found at $INSTALLER_PATH"
        }

    } catch {
        Write-Host "An error occurred: $_"
    }

}
 

Tags