When linked-clone desktops are not cleanly logged off and the “Refresh on logoff” policy is used, VMware Horizon View marks the desktop as “Already used” and blocks other users from accessing the machine.
This “Already Used” state is a default VMware security feature which prevents other users from accessing the previous user’s data and allows a VMware Horizon View administrator to investigate potential problems with the desktop.
The VMware Horizon View desktop can also go into the “Already Used” state if a virtual machine is powered on on another ESXi host in the cluster in response to an HA event, or if it was shut down without reporting to the broker that the user had logged out.
The problem with this “Already Used” state is that the default within VMware Horizon View waits until a View Administrator actually does something to resolve the issue.
To resolve the “Already Used” issue, you can
Refresh or delete the desktop through teh VMware Horizon View Administrator console (this is a manual action)
Set an LDAP attribute pae-DirtyVMPolicy in the VMware Horizon View ADAM database under OU=Server Groups,DC=vdi, DC=vmware, DC=int
pae-DirtyVMPolicy=0 – This is the default behavior of leaving the desktop in the error state and not available for use.
pae-DirtyVMPolicy=1 – This allows desktops that were not cleanly logged off to be available without being refreshed. The desktop is available in the pool for another user.
pae-DirtyVMPolicy=2 – This setting will automatically refresh a desktop in the “already used” state and make it available again in the pool.
I prefer to set the pae-DirtyVMPolicy to 2 so “Already Used” situations will be automatically resolved by VMware Horizon View.
Changing the pae-DirtyVMPolicy needs to be done for each pool.
Manual method of setting the pae-DirtyVMPolicy value:
Start the ADSI Edit utility on your VMware Horizon View Connection Server host. Go to Start > Programs > ADAM > ADAM ADSI Edit.
Select or type a Distinguished Name or connect to DC=vdi, DC=vmware, DC=int.
Select or type a domain or server to localhost:389.
Locate the OU=Server Groups for editing.
Under the Server Groups OU, double-click CN=pool_name. This opens the properties of the CN.
Click the pae-DirtyVmPolicy attribute and click Edit.
Set the pae-DirtyVmPolicy attribute
PowerCLI method of setting the pae-DirtyVMPolicy value:
We run each step sepratly, however, you can change that and run everything in one line…
Cleanup the DB
Last part runs sqlcmd using a .SQL file from MSFT Gallery, and yes, you can download and install the PowerShell tools for SQL and use that instead. Most of your customers dont have thoose tools installed, so sqlcmd.exe it is