By Product VMware Horizon

View 3.1: Pass Client Information into the Virtual Machine

Among the many cool things you can do with View 3.1, a component of VMware Horizon, is the ability to pass information about the client into the virtual machine (VM). You can now pass the client name, IP address and MAC into the VM.

This information is sent to the View agent running in the VM and is stored in the registry:

HKCU\Volatile Environment

This information can be gathered every time you log in. So if a user changes location, you can see that change in the variables. This can be run with the CommandsToRunOnConnect once the VDM_AGENT.ADM template has been configured in your AD and have assigned the polices for CommandToRunOnConnect and/or CommandToRunOnReconnectoption.

Here is an example of how it can be used. Values on the guest VM should be as follows:

HKLM\Software\Policies\VMware, Inc.\Vmware VDM\Agent\Configuration\CommandsToRunOnConnect
Command1=“wscript.exe  c:\reconnectscript.vbs”

HKLM\Software\Policies\VMware, Inc.\VMware VDM\Agent\Configuration\CommandsToRunOnReconnect
Command1=“wscript.exe  c:\reconnectscript.vbs”

Then write the script to look something like the following. The below will pop the information up in a small window:

Begin Script
Const HKEY_CURRENT_USER  = &H80000001

Set wmiLocator=CreateObject(“WbemScripting.SWbemLocator”)
Set wmiNameSpace = wmiLocator.ConnectServer(“.”, “root\default”)
Set objRegistry = wmiNameSpace.Get(“StdRegProv”)

sPath = “Volatile Environment”

lRC = objRegistry.GetStringValue(HKEY_CURRENT_USER, sPath, “ViewClient_Machine_Name”, vMachine)
lRC = objRegistry.GetStringValue(HKEY_CURRENT_USER, sPath, “ViewClient_IP_Address”, vIP)
lRC = objRegistry.GetStringValue(HKEY_CURRENT_USER, sPath, “ViewClient_MAC_Address”, vMAC)

msgbox “The Remote Device Name is ” & vMachine & ” @ ” & vIP & ” (” & vMAC & “) ”

End Script

The idea is that now I can pass that information to applications that could map things like printers to an actual location that the user in coming in from. The possibilities are endless. Enjoy.

mini guide to View in VMware Horizon 7View is a component of VMware Horizon 7. Find out what’s new: