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 8.8.8.8 and 8.8.4.4.  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 (192.168.201.0/24).

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:

PIPVDI{n:fixed=2}

My first VDI provisioned would be named PIPVDI01.  I setup the post synchronization script to assign a static IP of 192.168.201.51, a default gateway of 192.168.201.1, 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 192.168.201.51 255.255.255.0 192.168.201.1 1
IF %computername%==PIPVDI01 NETSH interface ip add dns name=”Local Area Connection” 192.168.201.15 index=1
IF %computername%==PIPVDI01 NETSH interface ip add dns name=“Local Area Connection” 192.168.201.16 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.”

script

 

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 *