HCX Removal

Have you finished your cloud migration and need to remove or uninstall HCX? VMware has a nice KB on how to do this. https://docs.vmware.com/en/VMware-HCX/4.2/hcx-user-guide/GUID-28172DB0-93C6-4A7A-B5A9-51C8325B02DC.html. Basically make sure all replications are finished, unextend any networks, delete any service meshes, delete the site pairing, power off the connector appliance, delete it, and unregister the extensions. Seems easy enough. How about those extensions? Log into the MOB go through the process or just run a quick script. Probably doesn’t matter unless you have a bunch of them to do. Like maybe you work for a cloud provider who uses HCX to do migrations. Enter the HCX extension remover:

https://github.com/khensler/VMware_Scripts/blob/main/hcx-extenstion-remover.ps1

$ExtensionManager = Get-View ExtensionManager
write-Host "Current Extensions:"
$ExtensionManager.ExtensionList | Select-Object @{Name='Description';Expression={$_.Description.Label}},Key,Company,Version | Sort-Object Description
write-host "HCX Extensions:"
$ext_hcx = $ExtensionManager.ExtensionList | Select-Object @{Name='Description';Expression={$_.Description.Label}},Key,Company,Version | Where-Object -Property Key -Like 'com.vmware.hybridity*' | Sort-Object Description
$ext_hcx
foreach ($ext in $ext_hcx){
    Write-Host "Removing Extension:" $ext.key
    $ExtensionManager.UnregisterExtension($ext.key)
}
write-host "Removing Extension: com.vmware.hcsp.alarm"
$ExtensionManager.UnregisterExtension("com.vmware.hcsp.alarm")
write-host "Removing Extension: com.vmware.vca.marketing.ngc.ui"
$ExtensionManager.UnregisterExtension("com.vmware.vca.marketing.ngc.ui")

The basis are get the extension manager, get all the extensions with the path com.vmware.hybridity*, unregister them, remove the two additional extensions listed by the KB. Of course you need to be connected to the vCenter you are removing HCX from for this to work. Seems like VMware could build this into the product pretty easily. There is a HCX Powercli module as well that can be leveraged to remove the service meshes and site pairings. But that’s for another post.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: