A Follow Up to Making ThinPrint work with VMware View and Profile Unity

Our Providence address:
999 Main Street, Suite 715
Pawtucket, RI 02860
Our Boston address:
800 South Street, Suite 300
Waltham, MA 02453

A Follow Up to Making ThinPrint work with VMware View and Profile Unity

Added on: 07.08.13, by Andy Ward

After posting my recent ThinPrint article (which can be read here), I was contacted by Liquidware Labs on the topic of performing the whole process on a reconnect rather than requiring the Windows logon process to fire off Profile Unity.  LWL said we could achieve this entirely with Unity rather than using Group Policy and Visual Basic scripting.  This was a really desirable approach since it's a lot easier to understand what Unity is doing as opposed to picking through GPOs and VB scripts.  Plus it keeps all the configuration in one place.

What I wasn't aware of prior to speaking with LWL was that Unity can be executed on reconnect with View. The View GPOs offer "CommandsToRunOnReconnect", shown below, as well as some other similar ones. The trick here is to use Unity to plant the same functionality into the registry, instead of using the GPO. This is really all the GPO does anyway. It adds the necessary registry key(s) to perform some function with the View agent. The manually added registry equivalent to the highlighted field above is:

Filter: Yourfilter
Action: Write Value
Hive: HKEY_LOCAL_MACHINE Key: SOFTWARE\Policies\VMware, Inc.\VMware VDM\Agent\Configuration\CommandsToRunOnReconnect
Data Type: REG_SZ
Value: Command1
Data: %systemroot%\system32\cmd.exe /c \\yourdomain.local\netlogon\profileunity\scripts\script.cmd

Learning about this piece was nice, but what I didn't know was that Unity, or a specific Unity configuration different from my default configuration, could be executed on reconnect. This meant that I could build a new Unity config that handled only the ThinPrint control as shown in my last article and execute it when the user reconnects. This way, if the user is in the main office with ThinPrint disabled and they disconnect, go home, and connect up remotely, ThinPrint will start up quietly so remote printing will be available. My original configuration would have required the user to run through the logon process to execute Unity to achieve this. This will insure the desired result regardless and remove the human element.

The following steps do not change anything that was done in the last post on this topic. This is in addition to everything that was done previously.

1: On the default Unity configuration add the registry rule shown above in blue. Please note that the "scripts" folder needs to be created under the "profileunity" folder and the "script.cmd" batch file, which we'll get to in step 2, needs to be created and placed there. This registry rule will force the View agent to fire off the script.cmd batch file when the user reconnects to a session that's already logged on. It will not execute during a normal logon when the default Profile Unity execution occurs.

2: Create the "script.cmd" batch file under \\yourdomain.local\netlogon\profileunity\scripts\. The batch file should contain:

@echo off

"C:\Program Files\ProfileUnity\FlexApp\lwl_userapp_trigger.exe" "C:\Program Files\ProfileUnity\client.exe" /inipath:\\yourdomain.local\netlogon\ProfileUnity\ini\printers.ini //netpath:\\yourdomain.local\netlogon\ProfileUnity\ //silent /elevate

Note the "printers.ini" file referenced above. This is the new Unity config that will execute during reconnect. This is not your default ProfileUnity configuration file. In my case, it's a config that's only calling the batch files to stop and start the TPAutoconnect service. See my previous article for that info. Additionally, note the path that it's in. I've created a subfolder under my "ProfileUnity" folder and placed "printers.ini" here. This is important as the file needs to be outside of the "ProfileUnity" folder or it will run with the normal Unity execution during logon.

This batch file will trigger Unity to run the "printers.ini" configuration silently. No Unity splash screen will be seen and it's using Elevation so you can perform tasks that the user isn't allowed to perform. As long as step 1 has been performed, you could manually execute this batch file or even schedule it to perform other types of tasks.

View All Blog Articles