Script uninstall VMware EUC Agents – App Volumes Agent, Horizon Client, DEM Agent, Horizon Agent and VMware Tools

29 Jun

If you are planning for the VMware EUC Stack migration or upgrade and are in the middle of uninstalling the existing agents, look no further and here is the script that will allow you to uninstall all the agents and reboot the golden image towards the end. There is no need to remove individual agents one by one from the “Program and Features”; instead, sit back, relax and have a coffee!

VMware EUC Agents:

  • VMware App Volumes Agent (Works on 2.x and 4.x/YYMM)
  • VMware Horizon Client (Optional)
  • VMware Dynamic Environment Manager Agent (Works on 9.x and YYMM)
  • VMware Horizon Agent (Works on 7.x and 8.x/YYMM)
  • VMware Tools (Works on 11.x)

Note – All the above testing is carried out on Windows 10 1909/Windows Server 2016 with PowerShell 5.1. The PowerShell module Uninstall-Package suppresses individual reboot and we perform the final reboot towards the end using the Restart-Computer module. (Reboot is required to complete the uninstallation operations.)

VMware EUC Agents
#################################################################################
# Un-Install EUC Agents in the proper order for Golden Image
# App Volumes Agent, Horizon Client(Optional), DEM, Horizon and VMware Tools
# Suppressed auto Reboot the OS towards the end after un-installing all Agents.
# Comment or Un-comment the Agent that does not apply to your environment
# Author - Aresh Sarkari (Twitter - @askaresh)
#################################################################################

#Un-installing VMware App Volumes Agent
Write-Host "Un-installing the App Volumes Agent" -ForegroundColor Green
Get-Package -Name 'App Volumes **' | Uninstall-Package

sleep -Seconds 60

#Un-installing VMware Horizon Client
#Write-Host "Un-installing the VMware Horizon Client" -ForegroundColor Green
#Get-Package -Name 'VMware Horizon Cli**' | Uninstall-Package

#sleep -Seconds 60

#Un-installing VMware Dynamic Environment Agent
Write-Host "Un-installing the Dynamic Environment Agent" -ForegroundColor Green
Get-Package -Name 'VMware Dynamic **' | Uninstall-Package

sleep -Seconds 60

#Un-installing VMware Horizon Agent
Write-Host "Un-installing the VMware Horizon Agent" -ForegroundColor Green
Get-Package -Name 'VMware Horizon Ag**' | Uninstall-Package

sleep -Seconds 60

#Un-installing VMware Tools Agent
Write-Host "Un-installing the VMware Tools Agent" -ForegroundColor Green
Get-Package -Name 'VMware Tools' | Uninstall-Package

sleep -Seconds 60

# Restart the computer
Write-Host "Restarting the computer post the VMware EUC Agents Un-install" -ForegroundColor Green
Restart-Computer -Force

GitHub scripts/vmwareeucagent-uninstall at master · askaresh/scripts (github.com)

Thanks to Hilko and Joel for reviewing the script and providing valuable feedback.

I hope you will find this script useful to uninstall the VMware EUC agents and never look back to remove individual programs under “Programs and Features”. A small request if you further enhance the script or make it more creative, I hope you can share it back with me?

Thanks,
Aresh Sarkari

3 Responses to “Script uninstall VMware EUC Agents – App Volumes Agent, Horizon Client, DEM Agent, Horizon Agent and VMware Tools”

  1. ARUNKUMAR MAHARAJA July 1, 2021 at 3:22 pm #

    Hello Aresh, Very good Article with well explanation.

    Have query related to this.

    We have environment Horizon 7.8 and want to migrate to Horizon 8.2. We have 90% Full clone VDIs. We were looking for automate the process uninstall and reinstall the agents.

    However we have NVIDIA as well. if we uninstall, we need to follow below order,

    1) NVIDIA Uninstall -> reboot
    2) vROPS Uninstall -> Reboot not required
    3) View Agent Uninstall -> Reboot
    4) VMware Tools Uninstall -> Reboot

    And same way for installing the EUC agents from below to top with NVIDIA.

    Is it possible to do automate these process by running the Script. if yes, please share your comments.

    Thanks in advance.

    Regards,
    Arun

    • askaresh July 5, 2021 at 9:44 am #

      Hi Arun,
      Yes you can further extend the script to include NVIDA. We are already doing VMware tools here is the code you can include within the script. Note our observations is a reboot is required post the vmware tools or/else Horizon Agent fails to install.

      $VMwareToolsName = “VMware-tools*”
      $TempInstallPath = “C:\Temp\Agents”
      $VMWToolslogFile = “C:\Temp\Agents\VMWTools.log”

      $VMWToolsMSIArguments = @(
      “/qb”
      “ADDLOCAL=All”
      “REMOVE=Hgfs,SVGA,VSS,AppDefense,NetworkIntrospection”
      “REBOOT=REallySuppress”
      “/L*v”
      $VMWToolslogFile
      )

      # Install VMware Tools x64
      Write-Host “Installing the VMware Tools x64” -ForegroundColor Green
      $VMWToolsPath = (Get-ChildItem -Path $TempInstallPath | Where-Object {$_.name -like $VMwareToolsName}).Fullname

      # The switches “/s /v ” is the Install Shield switches and rest of the aruguments are passed with MSI
      $VMWToolInstall = (Start-Process -Filepath $VMWToolsPath -Wait -ArgumentList “/s /v “”$VMWToolsMSIArguments” -PassThru)
      $VMWToolInstall.ExitCode

Trackbacks/Pingbacks

  1. Script to install VMware EUC Agents – App Volumes Agent, DEM Agent and Horizon Agent | AskAresh - June 30, 2021

    […] If you are planning for the VMware EUC Stack migration or upgrade and want to install the VMware EUC agent, then continue reading. The guidance on uninstalling the existing agents can be found on this blog post – Script uninstall VMware EUC Agents – App Volumes Agent, Horizon Client, DEM Agent, Horizon Agent a… […]

Leave a Reply

%d bloggers like this: