VMware Tools fails to uninstall
search cancel

VMware Tools fails to uninstall

book

Article ID: 317452

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

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.”

 

 

 

Environment

VMware ESXi 6.7.x
VMware ESXi 6.5.x
VMware ESXi 6.0.x
VMware vSphere ESXi 7.x

Cause

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.

Resolution

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:
 

  1. Refer to this website (https://packages.vmware.com/tools/versions) as needed to identify the build # of the installed version of VMware Tools on the guest virtual machine
  2. Download the VMware-tools-<VERSION>-<BUILD>-x86_64.exe installer for the currently installed version of VMware Tools from this website (https://packages.vmware.com/tools/releases/)

 
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
 

  1. Copy the VMware Tools installer file to the Windows virtual machine

Example: VMware-tools-11.3.0-18090558-x86_64.exe
 

  1. Establish a Remote Desktop session to the Windows virtual machine
  2. Open a PowerShell command prompt and change directory to the local folder to which you copied the downloaded VMware Tools installer

cd C:\temp\vmwaretools
 

  1. Run the following commands (or, alternatively, execute the below script remotely using your preferred automation framework):

 
# 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