To upgrade or uninstall VMware Tools successfully on a Windows virtual machine.
Symptoms:
Upgrading or uninstalling an existing installation of VMware Tools on a Windows virtual machine fails with the error, “The feature you are trying to use is on a network resource that is unavailable.”
VMware ESXi 6.7.x
VMware ESXi 6.5.x
VMware ESXi 6.0.x
VMware vSphere ESXi 7.x
The cause is only partially understood.
Superficially the Microsoft Windows Installer framework is unable to locate the VMware Tools installation (.MSI) file in the local installer cache, and so prompts the user to provide the correct path. The path “C:\windows\TEMP\{092CAFE8-7A43-4C32-82C6-A5547F93417F}~setup\” (or similar)
In which MSIEXEC is looking for the installer appears to be the default extraction location for the MSI file when the Setup64.exe installer is extracted during the installation process (example: setup64.exe /x), but it is not clear at this time why this issue seems to be only intermittent.
The process to repair the MSI framework database to enable a clean uninstallation (and subsequent upgrade) of VMware Tools in a Windows Guest OS is as follows:
NOTE: do not attempt to execute the following steps using an installer for a different version of VMware Tools.
NOTE: if you need to remediate multiple virtual machines you can download the requisite VMware Tools installers, store them on a network share, and add a step to the below script to copy the correct installer file to the local VM
Example: VMware-tools-11.3.0-18090558-x86_64.exe
cd C:\temp\vmwaretools
# Get currently installed version of VMware Tools from the Windows registry
$currentVMtoolsVersion = (Get-ChildItem -Recurse HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty | Where-Object { $_.DisplayName -eq 'VMware Tools' }).DisplayVersion
# Construct the name of the VMware Tools installer that needs to be downloaded to the server
$exeInstallerName = "VMware-tools-" + $currentVMtoolsVersion.Substring(0, $currentVMtoolsVersion.LastIndexOf(".")) + "-" + $currentVMtoolsVersion.Substring($currentVMtoolsVersion.LastIndexOf(".") + 1) + "-x86_64.exe"
######## TO DO ########
# Copy file to server #
#######################
# Set the path to the installer (assuming it exists in current directory)
$exeInstallerPath = "$((Get-Location).Path)\$exeInstallerName"
# Extract the MSI package from the executable installer
# https://knowledge.broadcom.com/external/article/306737
# https://stackoverflow.com/questions/8681252/programmatically-extract-contents-of-installshield-setup-exe
$msiExtractionArguments = "/a /s /v `"/qn TARGETDIR=$((Get-Location).Path)`""
Start-Process -FilePath $exeInstallerPath -ArgumentList $msiExtractionArguments -Wait
# Force repair the installation using the downloaded installer
# https://www.itninja.com/question/the-msi-doesn-t-repair-when-the-install-source-is-removed-from-its-original-location-how-can-it-be-fixed
$msiexecArguments = "/fomusv `"$((Get-Location).Path)\VMware Tools64.msi`" /qn"
Start-Process msiexec -ArgumentList $msiexecArguments -Wait