Clearpath Insights: Managed Services | Cloud Services | IT Solutions

Location Based Applications with ThinApp and View

Virtual Desktops can be considered both the newest and the oldest craze in IT. As a leading technology integrator, Clearpath has been able keep up with the craze and stay ahead of the curve with multiple deployments around the VMware View suite. One of the best and most underrated components in the View suite is ThinApp.

ThinApp gives you the ability to package applications and stream them from a file server to the users. When combined with the View Connection Broker you can present an entire user experience from the operating system through specific applications assigned from the IT staff. Sounds great, but what if I don't care about the user and want the applications to always be installed on specific machines? This is especially useful in organizations looking to deploy virtual desktops across kiosk-styled thin clients.

Well, we can now do this through a little scripting and the use of Group Policy ADM files that ship with View. The viewagent.adm file is deposited on the Connection Broker automatically during install and can be imported into a Group Policy Object (GPO) on your domain. The key to the .adm file and accompanying GPO is the ability to run scripting based on the local client. This is effectively accomplished by pulling registry information from the guest VM OS. You have the option of everything from the IP address to the host name or even the MAC address. To illustrate, I've pulled together a script that allows you to register a specified application to any machine named accordingly. In this example every machine in the "Blue Room" is named "BlueRoom-XXX" and all the applications in the "Blue" folder will get published to it along with everything in the "All" folder.

Const HKEY_CURRENT_USER = &H80000001

Set WSHShell = CreateObject("WScript.Shell")
Set objShell = CreateObject("Shell.Application")
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)

tokens = split(vMachine, "-")


Select Case (Room)

Case "BlueRoom"
   WSHShell.Run("""\\appsserv\thinapp$\thinreg.exe"" /q ""\\appsserv\thinapp$\All\*.exe""")
   WSHShell.Run("""\\appsserv\thinapp$\thinreg.exe"" /q ""\\appsserv\thinapp$\Blue\*.exe""") Case "RedRoom"
   WSHShell.Run("""\\appsserv\thinapp$\thinreg.exe"" /q ""\\appsserv\thinapp$\All\*.exe""")
   WSHShell.Run("""\\appsserv\thinapp$\thinreg.exe"" /q ""\\appsserv\thinapp$\Red\*.exe""") Case "OrangeRoom"
   WSHShell.Run("""\\appsserv\thinapp$\thinreg.exe"" /q ""\\appsserv\thinapp$\All\*.exe""")
End Select

If your naming convention does not have a "-" in it or maybe you need to use the second part instead of the first, you would change the following lines:

tokens = split(vMachine, "-")

Room= tokens(0)

Simply change the "-" to your delimiter and if you need the third part you change the tokens to (2). Machine_1_BlueRoom would then still use BlueRoom as the variable.

If you want to use an IP address as your test and the subnets are different just use the tokens = split(vMachine,"."). Then Room=tokens(2) would give you the third octet (i.e. if the IP is the variable result would be 121). Remember this is not a number, it is a string, so greater than (>) and less than (<) will not work.

Need more than three options? Just add to the case statement. ThinApp now behaves as a location-based environment as opposed to user and/or OU.


Our engineers customize
IT solutions for your business

The best hardware, software and cloud computing solutions are nothing without expert design and implementation.

Our team becomes your team. We take the time to understand your business needs first, and tailor high performance systems specifically for you.

Learn more
Live Chat Support Software