Set all Horizon Client’s to Auto-Connect, or not without user involvement

** DISCLAIMER **This is not intended for use on a production platform, VMware does not recommend amending or touching the View ADAM database manually. You will not receive support if anything fails after amending this. This blog is a learning exercise only.

At VMware, I’m responsible for looking after the whole Workspace ONE and Horizon suite (our Digital Workspace/End User Computing solutions). Most of my work is supporting the Unified Endpoint Management (UEM) and Access solutions, but more recently I’ve been assisting with some Horizon questions.

With that, I was presented an interesting question. How can we set all existing Horizon clients to not automatically connect to a desktop pool? In cases where only 1 pool is assigned, or reset any users who have set this option manually.

Never fear, there is a way! With our good friend PowerShell we can go in and make changes to the View ADAM Database which is within ADSI.

I first did some digging in the ADSI Edit tool, to find out where the property was stored. I’ll review this first as it’s interesting to understand how to get to these options.


Now, we need to setup a query. Right click on the ‘Default naming context’, New > Query.

In the next dialog, you can name your query, and set the Root of Search and Query. Here I’m setting it to Properties, as this is where each Horizon Client config is kept. You can leave this at the top level if you want.

In this case, I wanted to find who had auto-connect set to False.


This will return you a set of records starting GUID=XXX. You can right click and open Properties.

You can then see all the values aligned to the property record. pae-NameValuePair is a ‘Multi-Valued String’, which can also contain settings for protocol and screenSize.

From here, you can manually click on the alwaysConnect item, click remove. This moved it to the Add field and you can edit it.

If you want to find out what user your amending for, you can check that in the ‘member’ field.

The PowerShell Script

The blow script will loop over all Properties elements in the Properties OU, and if the NameValuesPair is present, it will check if there is a alwaysConnect value set to True. If there is, it will remove it and add a record for false.

I’ve written this more because I found nothing specific to the View ADAM Database, and after piecing it together thought I’d contribute this to help anyone else looking into this.

$obj = [adsi]'LDAP://localhost:389/OU=Properties,DC=vdi,DC=vmware,DC=int';
foreach ($child in $obj.psbase.Children)
  if($child.class -like "pae-Prop") #Get the Properties entries
        $NameValues = $child.get("pae-NameValuePair"); #Get the name value pair from the system.
        $Target = $child.get("pae-Target"); #Get the Desktop Pool target for this property
        #Optional - If you want to set False for EVERY option, remove this statement and keep the $NameValues If
        if($Target -like "CN=ROAM01,OU=Applications,DC=vdi,DC=vmware,DC=int") # Name of the Desktop Pool
           if($NameValues -like "alwaysConnect=True") #This can be removed if you want to add False if a record doesnt exist
               #we have found a property with alwaysConnect set to true
               #Reset it to false
               $child.putex(4,"pae-NameValuePair",@("alwaysConnect=True")) #Remove the True value
               $child.putex(3,"pae-NameValuePair",@("alwaysConnect=False")) #Add the False value
               $child.setinfo() #Set the info!
               write-host $child.Guid
      Catch {}

If anyone in the Horizon community wants to correct anything, tell me this is insane, or theres a UI option for this I missed somewhere, more than happy for a comment below!


One Reply to “Set all Horizon Client’s to Auto-Connect, or not without user involvement”

  1. I didnt know client settings can be tweak on the ADAM database, the only time I go there is to delete stubborn pool.. Good to know thanks.. For managed zero client I use Teradici mgmt console. I can see your script is powerful for various unmanaged clients.

Leave a Reply

Your email address will not be published. Required fields are marked *