Purpose
This article provides information on removing invalid linked clone entries automatically by using the ViewDBChk tool in Horizon View 5.3 and later versions.
 
The ViewDbChk tool allows administrators to scan for and fix provisioning errors that can not be addressed using View Administrator.

Provisioning errors can occur when there are inconsistencies between the LDAP, vCenter and View Composer databases. These inconsistencies can be caused by (but are not limited to) direct editing of the vCenter inventory, restoring a backup, or a long term network problem.
 
This tool allows VMware View administrators to scan for machines which can not be provisioned and removes all invalid database entries from the necessary databases . The View Connection Server will then be able to re-provision the machine without any errors.
 Resolution
 
For Horizon View 6.1 and later, the ViewDbChk tool is included with your View Connection Server installation. For Horizon View 5.3 and 6.0, you must download the tool from the VMware Labs ViewDbChk fling page.

This tool must be executed on View Connection server.
 
To run the View DbChk tool:
  1. If required, unzip the tool into a new folder.
  2. Click StartRun, type cmd, and click OK. The Command Prompt window opens.
  3. Navigate to the ViewDbChk tool:

    For version Horizon View 6.1, ViewDbChk is located under: C:\Program Files\VMware\VMware View\Server\Tools\bin.
    For Horizon View 5.3 or 6.0, navigate to the folder created during the unzip process in step 1.
     
  4. Enter ViewDbChk with the required flags as listed below into the command prompt to find and clean your database inconsistencies.

    For example, to locate and list erroneous virtual machines, use ViewDbChk --scanMachines.

    The output provides you with the name of the bad entry and prompt you to remove it.

    Note: By default, the output displays all erroneous desktops found, but deletes only one result and must be run again. However, this can be avoided by using the --limit X flag, where X is the number of results to be deleted each time the command is run.

ViewDbChk Command Line Options

 
The following command line parameters are supported:
 
ParameterResult
--findDesktopFinds a desktop pool
--enableDesktopEnables a desktop pool
--disableDesktopDisables a desktop pool
--findMachineFinds a machine
--removeMachine
Removes a machine from a desktop pool. Before removing a machine, ViewDbChk prompts the user to disable the desktop pool. After removing the machine, ViewDbChk prompts the user to re-enable the desktop pool.
 
--scanMachinesSearches for machines that are in an error or cloneerror state or have missing virtual machines, lists the problem machines grouped by desktop pool, and gives the option to remove the machines. Before removing a machine, ViewDbChk prompts the user to disable the desktop pool. After removing all erroneous machines in a desktop pool, ViewDbChk prompts the user to re-enable the desktop pool.
--helpDisplays the syntax of ViewDbChk
--desktopName desktop_nameSpecifies the desktop pool name
--machineName machine_nameSpecifies the machine name
--limit maximum_deletesLimits the number of machines that ViewDbChk can remove. The default is 1.
--forceForces machine removal without user confirmation
--noErrorCheckForces the removal of machines that have no errors
--verboseEnables verbose logging
 

Command Line Examples:
 
Find a desktop pool by name.
ViewDbChk --findDesktop --desktopName <desktop name> [--verbose]
 
Enable a desktop pool.
ViewDbChk --enableDesktop --desktopName <desktop name> [--verbose]
 
Disable a desktop pool.
ViewDbChk --disableDesktop --desktopName <desktop name> [--verbose]
 
Find a machine by name.
ViewDbChk --findMachine --desktopName <desktop name> --machineName <machine name</font>> [--verbose]
 
Remove a machine from a desktop pool.
ViewDbChk --removeMachine --machineName <machine name> [--desktopName <desktop name>] [--force] [--noErrorCheck] [--verbose]
 
Scan all machines for problems. The scan can optionally be limited to a specific desktop pool.
ViewDbChk --scanMachines [--desktopName <desktop name>] [--limit <maximum deletes>] [--force] [--verbose]
 
Display help for all commands, or a specific command.
ViewDbChk --help [--commandName] [--verbose]