How to uninstall VMware Tools after azure Migration

How to uninstall VMware Tools after azure Migration

Table of Contents

How to uninstall VMware Tools after azure Migration :​ Method 1

To uninstall VMware Tools after an Azure migration, you can follow these steps:

  1. Clean Uninstallation:
    • Launch your Windows virtual machine.
    • Manually delete the VMware Tools installation files from the following locations:
      • C:\Program Files\VMware
      • C:\Program Files\Common Files\VMware
      • C:\ProgramData\VMware
      • C:\Users\username\AppData\VMware (Replace username with your actual username)
    • Delete all VMware-related drivers from the Windows Registry:
      • Open the Registry Editor (Regedit).
      • Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\.
      • Delete all VMware-related drivers, including:
        • vmci
        • vm3dmp
        • vmaudio
        • vmhgfs
        • vmmemctl
        • vmmouse
        • VMRawDisk
        • VMTools
        • vmusbmouse
        • vmvss
        • vmware physical disk helper services
        • VMwareCAF*
      • Also, delete the same driver under C:\Windows\System32\Drivers\.
    • Remove the VMware SVGA driver from the Device Manager.
    • Start Windows normally.
    • Install VMware Tools again.

 

How to uninstall VMware Tools after azure Migration :​ Method 2

If you Guys are having issue while running above manual Methods. Please use below PowerShell Script to remove the VMware tools after migration the VM in Azure :-

				
					#>
[CmdletBinding()]
Param (
    [Parameter(Mandatory=$false)]
    [ValidateSet('Install','Uninstall','Repair')]
    [string]$DeploymentType = 'Install',
    [Parameter(Mandatory=$false)]
    [ValidateSet('Interactive','Silent','NonInteractive')]
    [string]$DeployMode = 'Interactive',
    [Parameter(Mandatory=$false)]
    [switch]$AllowRebootPassThru = $false,
    [Parameter(Mandatory=$false)]
    [switch]$TerminalServerMode = $false,
    [Parameter(Mandatory=$false)]
    [switch]$DisableLogging = $false
)

Try {
    ## Set the script execution policy for this process
    Try { Set-ExecutionPolicy -ExecutionPolicy 'ByPass' -Scope 'Process' -Force -ErrorAction 'Stop' } Catch {}

    ##*===============================================
    ##* VARIABLE DECLARATION
    ##*===============================================
    ## Variables: Application
    [string]$appVendor = 'VMware, Inc.'
    [string]$appName = 'VMware Tools'
    [string]$appVersion = ''
    [string]$appArch = ''
    [string]$appLang = ''
    [string]$appRevision = ''
    [string]$appScriptVersion = '1.0.0'
    [string]$appScriptDate = 'XX/XX/20XX'
    [string]$appScriptAuthor = 'Jason Bergner'
    ##*===============================================
    ## Variables: Install Titles (Only set here to override defaults set by the toolkit)
    [string]$installName = ''
    [string]$installTitle = 'VMware Tools'

    ##* Do not modify section below
    #region DoNotModify

    ## Variables: Exit Code
    [int32]$mainExitCode = 0

    ## Variables: Script
    [string]$deployAppScriptFriendlyName = 'Deploy Application'
    [version]$deployAppScriptVersion = [version]'3.8.4'
    [string]$deployAppScriptDate = '26/01/2021'
    [hashtable]$deployAppScriptParameters = $psBoundParameters

    ## Variables: Environment
    If (Test-Path -LiteralPath 'variable:HostInvocation') { $InvocationInfo = $HostInvocation } Else { $InvocationInfo = $MyInvocation }
    [string]$scriptDirectory = Split-Path -Path $InvocationInfo.MyCommand.Definition -Parent

    ## Dot source the required App Deploy Toolkit Functions
    Try {
        [string]$moduleAppDeployToolkitMain = "$scriptDirectory\AppDeployToolkit\AppDeployToolkitMain.ps1"
        If (-not (Test-Path -LiteralPath $moduleAppDeployToolkitMain -PathType 'Leaf')) { Throw "Module does not exist at the specified location [$moduleAppDeployToolkitMain]." }
        If ($DisableLogging) { . $moduleAppDeployToolkitMain -DisableLogging } Else { . $moduleAppDeployToolkitMain }
    }
    Catch {
        If ($mainExitCode -eq 0){ [int32]$mainExitCode = 60008 }
        Write-Error -Message "Module [$moduleAppDeployToolkitMain] failed to load: `n$($_.Exception.Message)`n `n$($_.InvocationInfo.PositionMessage)" -ErrorAction 'Continue'
        ## Exit the script, returning the exit code to SCCM
        If (Test-Path -LiteralPath 'variable:HostInvocation') { $script:ExitCode = $mainExitCode; Exit } Else { Exit $mainExitCode }
    }

    #endregion
    ##* Do not modify section above
    ##*===============================================
    ##* END VARIABLE DECLARATION
    ##*===============================================

    If ($deploymentType -ine 'Uninstall' -and $deploymentType -ine 'Repair') {
        ##*===============================================
        ##* PRE-INSTALLATION
        ##*===============================================
        [string]$installPhase = 'Pre-Installation'

        ## Show Welcome Message
        Show-InstallationWelcome

        ## Show Progress Message (with the default message)
        Show-InstallationProgress

        ## Remove Any Existing Versions of VMware Tools      
        Remove-MSIApplications -Name 'VMware Tools'
        
        ##*===============================================
        ##* INSTALLATION
        ##*===============================================
        [string]$installPhase = 'Installation'

        If ($ENV:PROCESSOR_ARCHITECTURE -eq 'x86'){
        Write-Log -Message "Detected 32-bit OS Architecture." -Severity 1 -Source $deployAppScriptFriendlyName

        ## Install VMware Tools on 32-bit System
        $ExePath32 = Get-ChildItem -Path "$dirFiles" -Include VMware-tools*i386.exe -File -Recurse -ErrorAction SilentlyContinue
        If($ExePath32.Exists)
        {
        Write-Log -Message "Found $($ExePath32.FullName), now attempting to install $installTitle."
        Show-InstallationProgress "Installing VMware Tools. This may take some time. Please wait..."
        Execute-Process -Path "$ExePath32" -Parameters "/S /v""/qn REBOOT=R ADDLOCAL=ALL""" -WindowStyle Hidden
        }

        }
        Else
        {
        Write-Log -Message "Detected 64-bit OS Architecture" -Severity 1 -Source $deployAppScriptFriendlyName

        ## Install VMware Tools on 64-bit System
        $ExePath64 = Get-ChildItem -Path "$dirFiles" -Include VMware-tools*64.exe -File -Recurse -ErrorAction SilentlyContinue
        If($ExePath64.Exists)
        {
        Write-Log -Message "Found $($ExePath64.FullName), now attempting to install $installTitle."
        Show-InstallationProgress "Installing VMware Tools. This may take some time. Please wait..."
        Execute-Process -Path "$ExePath64" -Parameters "/S /v""/qn REBOOT=R ADDLOCAL=ALL""" -WindowStyle Hidden
        }
        }

        ##*===============================================
        ##* POST-INSTALLATION
        ##*===============================================
        [string]$installPhase = 'Post-Installation'

    }
    ElseIf ($deploymentType -ieq 'Uninstall')
    {
        ##*===============================================
        ##* PRE-UNINSTALLATION
        ##*===============================================
        [string]$installPhase = 'Pre-Uninstallation'

        ## Show Welcome Message
        Show-InstallationWelcome

        ## Show Progress Message (With a Message to Indicate the Application is Being Uninstalled)
        Show-InstallationProgress -StatusMessage "Uninstalling $installTitle. Please Wait..."


        ##*===============================================
        ##* UNINSTALLATION
        ##*===============================================
        [string]$installPhase = 'Uninstallation'

        ## Uninstall Any Existing Versions of VMware Tools
        Remove-MSIApplications -Name 'VMware Tools'

      
        ##*===============================================
        ##* POST-UNINSTALLATION
        ##*===============================================
        [string]$installPhase = 'Post-Uninstallation'


    }
    ElseIf ($deploymentType -ieq 'Repair')
    {
        ##*===============================================
        ##* PRE-REPAIR
        ##*===============================================
        [string]$installPhase = 'Pre-Repair'

        ##*===============================================
        ##* REPAIR
        ##*===============================================
        [string]$installPhase = 'Repair'


        ##*===============================================
        ##* POST-REPAIR
        ##*===============================================
        [string]$installPhase = 'Post-Repair'


    }
    ##*===============================================
    ##* END SCRIPT BODY
    ##*===============================================

    ## Call the Exit-Script function to perform final cleanup operations
    Exit-Script -ExitCode $mainExitCode
}
Catch {
    [int32]$mainExitCode = 60001
    [string]$mainErrorMessage = "$(Resolve-Error)"
    Write-Log -Message $mainErrorMessage -Severity 3 -Source $deployAppScriptFriendlyName
    Show-DialogBox -Text $mainErrorMessage -Icon 'Stop'
    Exit-Script -ExitCode $mainExitCode
}
				
			
Share with your Friends

Leave a Comment

Your email address will not be published. Required fields are marked *

Revan Mor

Typically replies within a day

Scroll to Top