May 16, 2014 - Sven Huisman

VMware Horizon View – default printer not remembered

With VMware Horizon View you can use thinprint to allow users to use the local connected printer to print. For example, when users connect from home and they have a local installed printer, Thinprint connects the local printer in the session using the Thinprint driver. This printer will become the default printer during the session. This is very practical, because the user doesn’t have to think about the printer that is connected to the session. The bad thing is, the next time the user works from the office, the previous default network printer the user had during the session connected from the office is not the default printer anymore. This is caused by the fact that the previous default printer (the one thinprint connects) isn’t available in the session connected from the office.

Assume that the users get network printers working from the office and that roaming profiles or Persona Management is configured.

When you ask VMware support about this, they will probably suggest to setup location-based printing. This will connect the nearest printer to the user, when the user launches a session from the office. Unfortunately, location-based printing is not always an option to implement.

You can also edit the clients registry, so the local connected printer will not be the default in the session. This is a good option if you can edit this setting on the home PC of your users and if the home PC is a Windows-based PC. On Mac OSX, this settings can’t be changed.

The easiest way to solve this, is to create a logoff-script that exports the default printer when connected from the office and create a logon-script to import the default printer when connected from the office. To check if a user is connected from the office, you can use different checks. In the following script, it checks if the user is connecting from a tunneled connection. I assume that internal users get a direct connection to the desktop and the external users are tunneled through a security server. If this is not the case, you could also check on client ip-range or client name.

Logoff script:
Set oShell = CreateObject("WScript.Shell")
Tunneled = oShell.ExpandEnvironmentStrings("%ViewClient_Broker_Tunneled%")
if (Tunneled = "false") then
oShell.Run("reg export ""HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows"" ""%APPDATA%\defaultprt.reg"" /y") 
End If
Logon script:
Set oShell = CreateObject("WScript.Shell")
Tunneled = oShell.ExpandEnvironmentStrings("%ViewClient_Broker_Tunneled%")
if (Tunneled = "false") then
oShell.Run("reg import ""%APPDATA%\defaultprt.reg"" /y") 
End If

Virtual Desktop Horizon / Thinprint / View / VMware /