«

»

Delete Horizon View based vCenter Server protected objects

“VMTurbo"

The other day after cleaning up Desktop pools and VDIs in Horizon View (version 6.2) and Horizon Composer (version 3.x)  i encountered a few items in vCenter Server (version 6) that shouldn’t be there.
All Horizon View Desktop Pools and VDI Desktops were deleted but the VMwareViewComposerRelicaFolder created by Horizon View Composer server when using Horizon View Linked Clone feature was still present in vCenter Server.

Screen Shot 2016-02-09 at 14.32.13

The folder also contained 2 greyed out replica VDI VMs. The VMwareViewComposerRelicaFolder and its objects are protected against manual or API removal by default meaning a vCenter Server user (or administrator) will not be able to remove these objects. Of course Horizon View can remove the objects. When you right click the replica VM(s) the options “Remove from Inventory” and “Delete from Disk” are greyed out.

Screen Shot 2016-02-09 at 14.27.39

To solve this, being able to delete the protected vCenter Server objects, you need to unprotect the vCenter Server objects. Thanks to my colleague Joel Lindberg this was a really quick procedure. Follow the steps outlined below to unprotect the vCenter Server Objects, delete the objects and reprotect the vCenter Server VMwareViewComposerRelicaFolder folder.

  • Log on to the Horizon View Composer server
  • Start a cmd prompt (i started one as administrator)
  • Go to directory %Drive-letter%:\Program Files (x86)\VMware\VMware View Composer
    • Where %Drive-letter% is the installation drive.
  • Unprotect
    • Run the following command to unprotect the VMwareViewComposerRelicaFolder and its objects:
      • sviconfig -operation=UnprotectEntity -DsnName=Composer_DSN_name -DbUsername=Composer_DSN_User_Name -DbPassword=Composer_DSN_User_Password -VcUrl=https://vCenter_Server_address/sdk -VcUsername=Domain\User_of_vCenter_Server_account_name -VcPassword=vCenter_Server_account_password -InventoryPath=/Datacenter_name/vm/VMwareViewComposerReplicaFolder -Recursive=true
        • DsnName is the ODBC name
        • DbUsername is the database/ODBC user name
        • DbPassword is the Database/ODBC user password
        • In my case the command looked like this (obviously a bit changed):
          • sviconfig -operation=UnprotectEntity -DsnName=ODBC-Composer -DbUsername=ComposerUser -DbPassword=”C0mp1234!” -VcUrl=https://vc01-siteA.customer.com/sdk -VcUsername=int\ext-magnus -VcPassword=”!External2020″ -InventoryPath=/DC01-siteA/vm/VMwareViewComposerReplicaFolder -Recursive=true
          • Hopefully you’ll get an output like this where 3 objects are being unprotected:
            WARNING: Unprotecting VC managed entities will allow operations (power on, delete, migrate) that can cause existing linked clones connected to those managed entities to fail to work correctly.
            Establishing database connection.
            Database connection established successfully.
            Loading all VC config entries.
            Identifying matched VC config entries.
            Identified 0 matched VC config entries.
            Identified 0 matched VC config entries with certificate validation set to true.
            No matched VC configure entry is found. Connecting to VC with no certificate validation
            Establishing connection to the VC server.
            VC server connection established successfully.
            Looking for the entity on the VC server.
            Folder found.
            Folder with MoId group-v116 sucessfully unprotected.
            VirtualMachine with MoId vm-362 sucessfully unprotected. |
            VirtualMachine with MoId vm-117 sucessfully unprotected.
            Successfully unprotected entities: 3
            Fail to unprotect entities: 0
  • Remove the objects
    • Right click the 2 replica VMs and select “Remove from Inventory”
      Screen Shot 2016-02-09 at 14.27.11
  • Reprotect /protectentiry
    • Run the following command to protect the VMwareViewComposerRelicaFolder and its future objects
      • sviconfig -operation=protectEntity -DsnName=Composer_DSN_name -DbUsername=Composer_DSN_User_Name -DbPassword=Composer_DSN_User_Password -VcUrl=https://crpvms2crpp3b1v.corp.nychhc.org/sdk -VcUsername=corp\anderssm -VcPassword=”2016#Jan26″ -InventoryPath=/Datacenter_name/vm/VMwareViewComposerReplicaFolder -Recursive=true
        • DsnName is the ODBC name
        • DbUsername is the database/ODBC user name
        • DbPassword is the Database/ODBC user password
        • In my case the command looked like this (obviously a bit changed):
          • sviconfig -operation=UnprotectEntity -DsnName=ODBC-Composer -DbUsername=ComposerUser -DbPassword=”C0mp1234!” -VcUrl=https://vc01-siteA.customer.com/sdk -VcUsername=int\ext-magnus -VcPassword=”!External2020″ -InventoryPath=/DC01-siteA/vm/VMwareViewComposerReplicaFolder -Recursive=true
            • Hopefully you’ll get an output like this where 1 object is protected.
              WARNING: Protecting VC managed entities will disallow operations (power on, delete, migrate) that can cause existing linked clones connected to those managed entities to fail to work correctly.
              Establishing database connection.
              Database connection established successfully.
              Loading all VC config entries.
              Identifying matched VC config entries.
              Identified 0 matched VC config entries.
              Identified 0 matched VC config entries with certificate validation set to true.
              No matched VC configure entry is found. Connecting to VC with no certificate validation
              Establishing connection to the VC server.
              VC server connection established successfully.
              Looking for the entity on the VC server.
              Folder found.
              Folder with MoId group-v116 sucessfully protected.
              Successfully protected entities: 1
              Fail to protect entities: 0

When completed you can right click the VMwareViewComposerReplicaFolder and make sure it cannot be deleted. There is also a VMware KB 1008704 that describes the Unprotect Entity procedure.

 

And YES, the pictures are from the vSphere Client and not the vSphere Web Client:)