Among the many cool things you can do with View 3.1 is the ability to pass information about the client into the VM. You can now pass the client name, IP address and MAC into the VM. A big thank you to Todd D for all the heavy lifting with this post!
This information is sent to the View agent running in the VM and is stored in the registry.
HKCU\Volatile Environment
ViewClient_MachineName: TC01
ViewClient_IP_Address: 10.10.10.1
ViewClient_MAC_Address: 0a:0a:0a:0a:0a:0a
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.

Hi Jason,
At what stage of the logon do these variables get populated into the HKCU\Volatile Environment ? The software I work on runs at logon and supports ICA/RDP, I’m going to add support for VMware view and I’m interested to know how early in logon I can rely on this information being present.
In fact, perhaps I should ask, should I be using this information at all or is it available through an API call of some kind?