Over the last few years, there have been a couple of times a customer asked me to create a package they could push out to endpoints that would have the Connection Server URL pre-populated. It’s easy enough to have it populate with a registry key, but I also want it to automatically connect to the server as opposed to the user selecting the pre-populated server. I have not found a good way to do that with a registry value. If you launch the client once, and then tell the client to automatically connect to that server in the future, that will work. But what the client was looking for is zero user intervention required. They double click the shortcut, and are prompted for credentials.

After playing around a little bit, I figured out that a pretty easy way to do this is to just run the application with the --serverURL flag. Since the end goal is to push this with some management software, I just created a VBScript snippet to push along with the Horizon Client that will modify the shortcuts on the desktop as well as the Start Menu to append the flag and server name. These will be Windows 7 machines, but obviously you could modify the path to any relevant shortcuts to modify. This is certainly not the cleanest thing I’ve ever done, but it ensures that the client can push new versions of the client without me, as opposed to if I were to do something like repackage the installer.

Hope this helps someone in a deployment similar to this one!

[code language=”vb”] ‘ ******** Create objects and variables ********Set sh = CreateObject("WScript.Shell")flags = "–serverURL view.virtadmin.com"

‘ ******** Modify shortcut on All Users desktop ********

Set shortcut = sh.CreateShortcut("C:UsersPublicDesktopVMware Horizon Client.lnk")

shortcut.Arguments = flags

shortcut.Save

‘ ******** Modify Start menu shortcut ********

Set shortcut = sh.CreateShortcut(_

"C:ProgramDataMicrosoftWindowsStart Menu\VMwareVMware Horizon Client.lnk")

shortcut.Arguments = flags

shortcut.Save

[/code]