VMware View Agent Unreachable – Post Synchronization Script for home lab

In my home lab, I’ve setup an installation of VMware Horizon View 5.3.  This includes a Composer installation on my vCenter server, a VMware View Connection server, and a VMware View Security Server.

On my home network’s LAN, my DHCP server is my router, which doles out DNS settings to configure clients to use and  I found that when provisioning VMware View VDIs, I kept seeing “Agent Unreachable” within the VMware Horizon View Administrator console.

I quickly came to realize that the VDI that I provisioned wasn’t able to communicate with my internal Active Directory infrastructure, which happens to be a domain which is on the same subnet as my LAN (

My options were:

  1. Configure my DHCP server (router) to dole out static DNS entries for my DC’s (.15 and .16)
  2. Configure static IPs with static DNS entries for my DC’s on my router

Option 1 would have resulted in Internet connectivity being affected should my ESXi server go down, or if the DCs were rebooted.  This wasn’t an option for me.

VMware Horizon View allows you to configure a Post Synchronization Script to run after VDI provisioning.  I picked a static IP address outside of my DHCP range that I would assign to the first VDI.  I’ve also configured the View pool to dynamically name desktops based on the following pattern:


My first VDI provisioned would be named PIPVDI01.  I setup the post synchronization script to assign a static IP of, a default gateway of, and static DNS of my 2 DC’s on the domain – .15 and .16. The script is as follows:

IF %computername%==PIPVDI01 NETSH interface ip set address name=”Local Area Connection” static 1
IF %computername%==PIPVDI01 NETSH interface ip add dns name=”Local Area Connection” index=1
IF %computername%==PIPVDI01 NETSH interface ip add dns name=“Local Area Connection” index=2

You can place this script in a folder of your choice on the master image – I placed this script inside C:\Administration\Scripts\vdi-static-ip.bat and took a snapshot.  From that snapshot, I provisioned the first VDI, and specified the post synchronization script.  Using this script allowed the VDI to be able to communicate with the domain, and the View agent was able to report “Available.”



If you plan on provisioning more VDIs to the pool in the same fashion, you can simply add more IF statements and increment the VDI name and IP address by 1.  No need to make a global change on your router and affect the rest of your network on your home lab.

You may also like...

Leave a Reply

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