A quick tip for the day, if you encounter any issues with your Horizon platform and you bring it back up from a backup or any other issues, and you see that some Instant Clones are missing, no worries you will need to do few things to clean up your Horizon View, with the ViewDbChk and ADSI Edit.
First step, login to your Horizon server. Once you are logged in you will need to open ADSI Edit and run these commands specifically.
Right click on ADSI Edit -> Connect To
EXACTLY Fill it out like I have it, or you will run into issues or corrupt something else. Once it is all filled out, click OK.
Name: Horizon View ADAM
Connection Point: DC=vdi, DC=vmware, DC=int
Computer: localhost:389
Now you see that you are connected to the ADAM database and you will now drill down to the specific areas.
First you want to remove the specific Horizon Pool(s) Ex. My Lab Horizon server has two Pools Download Desktop, Remote Desktop. These are both test pools. Be very CAREFUL to make sure you delete the proper CN=HORIZON_POOL.
After the desktop pool objects within the OU=Applications are deleted, you will want to delete the corresponding CN=HORIZON_POOL in the OU=Server Groups, this I have noticed wouldn’t let me rebuild the Horizon Pools with the previous name. After the OU=Server Groups have been removed it worked and let me create a new pool.
Next steps, is to run the viewdbchk.cmd, you will have to execute this from Command Prompt, you will not be able to just click on the .cmd file. Below I have provided the path so you may copy it and paste it in Command Prompt, ran as Administrator.
cd C:\Program Files\VMware\VMware View\Server\tools\bin
Once the script is ran you will see syntax and switches to use. I have provided a table of all them.
ViewDbChk --findDesktop --desktopName <desktop name> [--verbose]
Find a desktop pool by name.
ViewDbChk --enableDesktop --desktopName <desktop name> [--verbose]
Enable a desktop pool.
ViewDbChk --disableDesktop --desktopName <desktop name> [--verbose]
Disable a desktop pool.
ViewDbChk --findMachine --desktopName <desktop name> --machineName <machine name> [--verbose]
Find a machine by name.
ViewDbChk --removeMachine --machineName <machine name> [--desktopName <desktop name>] [--force] [--noErrorCheck] [--verbose]
Remove a machine from a desktop pool.
ViewDbChk --scanMachines [--desktopName <desktop name>] [--limit <maximum deletes>] [--force] [--verbose]
Scan all machines for problems. The scan can optionally be limited to a specific desktop pool.
ViewDbChk --help [--commandName] [--verbose]
Display help for all commands, or a specific command.
First, you will need to find the pool you want to operate on. But for this tutorial we will be removing the desktop pool. So you will need to scan for it
ViewDbChk --findDesktop --desktopName <desktop name> --verbose
Once you have found your Desktop Pool you want to scan, this will also delete the entry if the Virtual Machine is orphaned or no longer existing. If you encounter other issues, you will need to use the –force switch to forcefully remove the pool, but in my scenario I was able to remove a large pool of Instant Clones in the last image.
ViewDbChk --scanMachines --desktopName <desktop name> --limit <maximum deletes> --verbose
That is it! If you were able to remove all the Virtual Machines that were stuck in the Horizon View, now you are able to re-use or create a new pool even with the same name!