Universal VMware Tools Uninstaller

I’ve created the following Powershell script which will uninstall all versions of VMware Tools from a server.

Particularly handy for SCCM deployment.

uninstall_vmware_tools.ps1

$regpath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"

$regkey = gci $regpath | Get-ItemProperty | Where-Object{"VMware Tools" -contains $_.DisplayName}

#Uninstall String
msiexec /x $regkey.PSChildName /qn

#Reboot server within 120 seconds.
shutdown -r -f -t 120

 

The following is a validation script used for detection; confirming if successfully uninstalled.

check_vmware_tools.ps1

$regpath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"


$regkey = gci $regpath | Get-ItemProperty | Where-Object{"VMware Tools" -contains $_.DisplayName}

If($regkey)
{
Echo "Software still exists."
return $false;

}

Else
{
Echo "VMware Tools successfully uninstalled."
return $true;
}

 

REF: https://www.vmware.com/content/dam/digitalmarketing/vmware/en/pdf/techpaper/deploying-vmware-tools-using-sccm-user-guide.pdf