kb.defensx.com Open in urlscan Pro
2606:4700:10::6816:699  Public Scan

Submitted URL: https://url.avanan.click/v2/r01/___https://kb.defensx.com/docs/categories/44/topics/eaf584d2-23af-44ab-bb7b-52cf1b3a1c93_...
Effective URL: https://kb.defensx.com/docs/categories/44/topics/eaf584d2-23af-44ab-bb7b-52cf1b3a1c93
Submission: On October 29 via manual from US — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

KNOWLEDGE BASE



BROWSE DOCS

 * INTRODUCTION
   
   1. DefensX
   2. DNS & Web Filtering
   3. Zero Trust Files
   4. Zero Trust Credentials
   5. Remote Browser Isolation
   6. ADWare Protection
   7. Secure Mobile Browser
   8. Secure Browser Extension

 * DEPLOYMENT
   
   1.  Deployment via RMM
   2.  Deployment via Intune
   3.  Deployment via GPO
   4.  VDI and Terminal Servers
   5.  Operating System Agent
   6.  Windows Manual Deployment
   7.  Mac MDM Deployment
   8.  Mac Manual Deployment
   9.  Network Deployment
   10. Secure Mobile Browser
   11. Bypass Option
   12. AI Protections
   13. SaaS Restrictions
   14. Bookmark Manager

 * QUESTIONS & ANSWERS
   
   1.  Licensing
   2.  Onboarding
   3.  Active Directory
   4.  Conflicting Softwares
   5.  Virtual Desktops
   6.  Agent
   7.  Incognito Mode
   8.  DNS & Web Filtering
   9.  Reporting
   10. Using the Backend

 * INTEGRATIONS
   
   1. Azure AD
   2. Identity Providers

 * POLICY MANAGEMENT
   
   1. Configuring Policies
   2. Configuring Consents

 * TRAINING VIDEOS
   
   1. 2 Minute Videos
   2. Attack Scenarios
   3. Deep Dive
   4. MSP Admin Training Series

 * MSP AUTOMATION
   
   1. Overview
   2. External Notifications
   3. Integrations


FIXING MSI UPGRADE PROBLEM IN WINDOWS

Print
In this document
 * What is the MSI upgrade issue?
 * Is it specific to DefensX?
 * How can we solve this problem?

maintenance 2 agent 20


WHAT IS THE MSI UPGRADE ISSUE?

In any scenario where an MSI package is upgraded, the MSI file containing the
currently installed version must remain on the system.

During installation or upgrade, a copy of the MSI file is stored in the
%windir%\Installer folder by Windows, typically with a randomly generated name
such as 74f06.msi. Although the exact file name cannot be predicted, it can be
queried through the registry or PowerShell.

During the upgrade process, the uninstallation section of the MSI file
corresponding to the currently installed version is executed first. If the
cached MSI file in the %windir%\Installer folder is deleted for any reason,
Windows cannot execute the MSI for the current version, leading to difficulties
in upgrading or uninstalling the MSI properly.

In such cases, Windows also attempts to locate the original MSI file as a last
resort. For example, if an MSI file like C:\Windows\Temp\Example-1.0.msi was
downloaded and its cached version under the %windir%\Installer folder is
removed, the process can still proceed if the original file remains in its
original location (as indicated in the Windows Registry).

However, if both the cached and original files are removed from the system,
upgrading or uninstalling the software becomes impossible.


IS IT SPECIFIC TO DEFENSX?

No, this process is not specific to DefensX. It applies to all software packages
distributed as MSI (Microsoft Installer) files. The same problem can seen on
even the Microsoft SQL Server described here:
https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/install/windows/restore-missing-windows-installer-cache-files

The directory mentioned, %windir%\Installer, serves as a cache location for
Windows installer-based applications. It contains stripped-down versions of the
Windows installer data files. During installation, updating, or removal of an
application, this directory is utilized by the application to verify the
existence of previously installed items and determine the necessary steps for
the installer to take next.

The files stored in this directory are unique to each machine. Therefore,
attempting to delete these files and replace them with copies from another
machine would be inappropriate. Removing items from this directory can
potentially lead to application crashes or, in severe cases, require the
reinstallation and patching of the affected application.


HOW CAN WE SOLVE THIS PROBLEM?

The only solution is to download the same MSI file into the same location with
the same name.

Due to the cached names being different from computer to computer, they must be
queried through registry or Powershell and should be copied with the correct
name.

To download the original DefensX Agent MSI file to the correct location easily;

 * run a Powershell as Administrator

 * copy and paste the following commands as a whole in the Powershell window

# Check if the DefensX Agent msi file is exist, if not try to download it
$program = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -eq "DefensX Agent" }

if ($program -ne $null) {
    # Check if the LocalPackage exists in the filesystem
    if (Test-Path $program.LocalPackage) {
        Write-Host "DefensX Agent is installed and LocalPackage exists. No need to download."
    } else {
        # Define the URL for downloading the latest version
        $downloadUrl = "https://cloud.defensx.com/defensx-installer/latest.msi?v=$($program.Version)"

        Write-Host "Downloading DefensX Agent version $($program.Version)..."
        $ProgressPreference = 'SilentlyContinue'
        $response = Invoke-WebRequest -Uri $downloadUrl -OutFile $program.LocalPackage -UseBasicParsing

        if ($response.StatusCode -eq 404) {
            Write-Host "This version ($($program.Version)) doesn't exist on cloud. It can't be downloaded"
        } else {
            if (Test-Path $program.LocalPackage) {
                Write-Host "DefensX Agent installer downloaded successfully to: $($program.LocalPackage)"
            } else {
                Write-Host "Failed to download DefensX Agent installer."
            }
        }
    }
} else {
    Write-Host "DefensX Agent is not installed."
}

Note
You can also create a Powershell script and run it. But if you received an error
like Restricted Execution Policies, you need to execute Set-ExecutionPolicy
-ExecutionPolicy Unrestricted -Scope Process command first to allow running the
script for the current Powershell session. Or you may run the script as:
powershell -ExecutionPolicy Bypass -File scriptname.ps1

maintenance 2 agent 20