Using VMware Horizon pool linked clone desktop, we often set desktops to be refreshed or deleted once the user logs off the session.
When a use logs off, default behavior will be: Machine would be refreshed or deleted as per the policy selected but actual behavior that we may see in our pool inventory as below
VMware View virtual machines are unavailable.
The View Administrator console shows the status of virtual machine as:"Already Used " OR "Agent Disabled"
Why machines land into these status ?
Basically this is a security feature in Horizon View to stop previous session to be available at next logon.
More Over this happens when there is some issue occurred at vCenter level, in response to HA or any other activity and agent fails to report back status to connection server hence, leaving status in inventory as already used or agent disabled.
What can be done to stop this ? VMware provides us the option to change default behavior by making few changes into the ADAM DB.
for that We need to change value of a parameter called pae-DirtyVMPolicy in ADAM DB for the Pool.
Follow below steps to make changes as per need
The pae-DirtyVMPolicy values provide these options for the Refresh on logoff policy:
pae-DirtyVMPolicy=0: Mark virtual machines that were not cleanly logged off as Already used and block user access to them. This is the default behavior in View 4.6 and later releases.
pae-DirtyVMPolicy=1: Allow virtual machines that were not cleanly logged off to become available without being refreshed. View Client users can access these desktops.
pae-DirtyVMPolicy=2: Automatically refresh virtual machines that were not cleanly logged off. View Client users can access these desktops after the refresh operation is completed.
In our case setting pae-DirtyVMPolicy=2 will solve the issue
for making this change Make sure we have a snap shot of View Connection server
Connect to horizon view connection server using RDP and open ADSI EDIT
open and connect to ADSI
Provide dc=vdi,dc=vmware,dc=int and localhost:389 as mentioned below and click ok to connect
Expand left and go to OU=Server Groups and on the right you should see all pools by Pool name.
Select the Pool you need to set policy and find pae-DirtyVmPolicy double click on this and set policy value as 2 (which means view will automatically refresh all such VMs which did not log of cleanly)
Make sure we have same policy for each pool
Setting up pae-DirtyVmPolicy=2 will make sure we have a clean desktop availability in pool after each log off which is not clean.