With the ViewDbChk command, you can resolve inconsistencies in the databases that store information about desktop virtual machines in an automated desktop pool and RDS hosts in an automated farm.

In a Horizon 7 environment, information about desktop virtual machines and RDS hosts in an automated farm is stored in the following places:

  • The LDAP database
  • The vCenter Server database
  • For View Composer linked-clone machines only: the View Composer database

Normally, you can recover from an error that occurs during provisioning or other operations by removing or resetting a desktop virtual machine or an RDS host using Horizon Administrator. On rare occasions, the information in the different databases about a machine that is in an error state might become inconsistent and it is not possible to recover from the error using Horizon Administrator. You might see one of the following symptoms:

  • Provisioning fails with the error message Virtual machine with Input Specification already exists.
  • Recomposing a desktop pool fails with the error message Desktop Composer Fault: Virtual Machine with Input Specification already exists.
  • Horizon Administrator shows that a desktop machine or an RDS host is stuck in a deleting state.
  • You cannot delete a desktop pool or an automated farm.
  • You cannot delete a desktop machine or an RDS host.
  • In Horizon Administrator's Inventory tab, the status of a desktop machine or an RDS host is missing.

In situations where database inconsistencies cause a desktop machine or an RDS host to be in an unrecoverable error state or prevent a Horizon Administrator task from completing successfully, you can use the ViewDbChk command to resolve the inconsistencies. The ViewDbChk command has the following characteristics:

  • ViewDbChk is automatically installed when you install Horizon Standard Server or Horizon Replica Server. The utility is not installed when you install Horizon Security Server.
  • ViewDbChk is a command that you can run from the Windows Command Prompt or from a script.
  • ViewDbChk supports automated farms and automated desktop pools of full virtual machines as well as View Composer linked clones.
  • When you want to remove a machine, ViewDbChk performs a health check on the machine and prompts you for additional confirmation if the machine looks healthy.
  • ViewDbChk can delete erroneous or incomplete LDAP entries.
  • ViewDbChk supports input and output using I18N character sets.
  • ViewDbChk does not remove user data. For a full desktop virtual machine, ViewDbChk removes the virtual machine from inventory but does not delete it from disk. For a linked-clone desktop virtual machine, ViewDbChk deletes the virtual machine and archives the user disks to the root folder in the case of VMFS datastores or to a sub-folder named archiveUDD in the case of vSAN and Virtual Volumes datastores.
  • ViewDbChk does not support unmanaged desktop machines or RDS hosts in a manual farm.

ViewDbChk Syntax

ViewDbChk --findDesktop --desktopName <desktop pool or farm name> [--verbose]

ViewDbChk --enableDesktop --desktopName <desktop pool or farm name> [--verbose]

ViewDbChk --disableDesktop --desktopName <desktop pool or farm name> [--verbose]

ViewDbChk --findMachine --desktopName <desktop pool or farm name> --machineName <machine name> [--verbose]

ViewDbChk --removeMachine --machineName <machine name> [--desktopName <desktop pool or farm name>] [--force] [--noErrorCheck] [--verbose]

ViewDbChk --scanMachines [--desktopName <desktop pool or farm name>] [--limit <maximum deletes>] [--force] [--verbose]

ViewDbChk --help [--commandName] [--verbose]

ViewDbChk Parameters

Parameter Description
--findDesktop Finds a desktop pool or farm.
--enableDesktop Enables a desktop pool or farm.
--disableDesktop Disables a desktop pool or farm.
--findMachine Finds a machine.
--removeMachine Removes a machine from a desktop pool or farm. Before removing a machine, ViewDbChk prompts the user to disable the desktop pool or farm. After removing the machine, ViewDbChk prompts the user to re-enable the desktop pool or farm.
--scanMachines Searches for machines that are in an error or cloneerror state or have missing virtual machines, lists the problem machines grouped by desktop pool or farm, and gives the option to remove the machines. Before removing a machine, ViewDbChk prompts the user to disable the desktop pool or farm. After removing all erroneous machines in a desktop pool or farm, ViewDbChk prompts the user to re-enable the desktop pool or farm.
--help Displays the syntax of ViewDbChk.
--desktopName <desktop name> Specifies the desktop pool or farm name.
--machineName <machine name> Specifies the machine name.
--limit <maximum deletes> Limits the number of machines that ViewDbChk can remove. The default is 1.
--force Forces machine removal without user confirmation.
--noErrorCheck Forces the removal of machines that have no errors.
--verbose Enables verbose logging.
Note: All the parameter names are case-sensitive.

ViewDbChk Usage Example

A desktop machine named lc-pool2-2 is in an error state and we cannot remove it using Horizon Administrator. We use ViewDbChk to remove it from the Horizon 7 environment.

C:\Program Files\VMware\VMware View\Server\tools\bin\viewdbchk.cmd --removeMachine --machineName lc-pool2-2 
Looking for desktop pool "lc-pool2" in LDAP...
   Desktop Pool Name: lc-pool2
   Desktop Pool Type: AUTO_LC_TYPE
   VM Folder: /vdi/vm/lc-pool2/
   Desktop Pool Disabled: false
   Desktop Pool Provisioning Enabled: true
Looking for machine "/vdi/vm/lc-pool2/lc-pool2-2" in vCenter...
   Connecting to vCenter "https://10.133.17.3:443/sdk". This may take some time...
Checking connectivity...
   Connecting to View Composer "https://10.133.17.3:18443". This may take some time...
The desktop pool "lc-pool2" must be disabled before proceeding. Do you want to disable the desktop pool? (yes/no):yes
Found machine "lc-pool2-2"
   VM Name: lc-pool2-2
   Creation Date: 1/25/15 1:20:26 PM PST
   MOID: vm-236
   Clone Id: b12a9ed2-8535-44ee-a9d6-6c9b5cf6f878
   VM Folder: /vdi/vm/lc-pool2/lc-pool2-2
   VM State: ERROR
Do you want to remove the desktop machine "lc-pool2-2"? (yes/no):yes
Shutting down VM "/vdi/vm/lc-pool2/lc-pool2-2"...
Archiving persistent disks...
Destroying View Composer clone "b12a9ed2-8535-44ee-a9d6-6c9b5cf6f878"...
Removing ThinApp entitlements for machine "/vdi/vm/lc-pool2/lc-pool2-2"...
Removing machine "/vdi/vm/lc-pool2/lc-pool2-2" from LDAP...
Running delete VM scripts for machine "/vdi/vm/lc-pool2/lc-pool2-2"...
Do you want to enable the desktop pool "lc-pool2"? (yes/no):yes