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.
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
HKLM\Software\Policies\VMware, Inc.\VMware VDM\Agent\Configuration\CommandsToRunOnReconnect
Then write the script to look something like the following. The below will pop the information up in a small window:
Const HKEY_CURRENT_USER = &H80000001
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 & ") "
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.