Video Screencast Help

Using a Template to Virtualize an Application with a Printer Driver

Created: 12 Apr 2012 | 3 comments
Language Translations
cdaguanno's picture
+2 2 Votes
Login to vote

                One of the more valuable capabilities of Symantec Workspace Virtualization is the ability for Symantec Workspace Virtualization to virtualize an application that has a printer or fax driver as part of the install.

                The Procedures to capture an application with a Printer or Fax driver can be found in the following connect articles.

http://www.symantec.com/connect/articles/virtualizing-print-driver-swv

https://www-secure.symantec.com/connect/articles/how-capture-print-driver-swv-and-sws

                Both of the articles for capturing printer drivers contain many steps as well as some manual editing. In this article we will explore how to streamline this process and make it simpler with Symantec Virtual Composer (SVC) templates. For more information regarding Templates see section 7 of the SVC users guide here.

There Are three main steps involved:

Step One:

                Download SWV and install Symantec Virtual Composer to create a packaging VM. More detailed information can be found here

Note: The Wise Virtual composer in now known as the Symantec Virtual Composer

Step Two:

                After installing the Symantec Virtual composer download the "Print driver capture template.ZIP" file attached to this article. Extract the "Print_Driver_Capture_V1.xpt" file from the archive and import the XPT template into the SVC. How to import the XPT file is explained here.

Step Three:

                Capture the application you wish to virtualize with its driver in the layer using the "Print_Driver_Capture_V1" template.

Note: The template attached to this article was created and made available to help the reader understand the concepts in the article. The scripts are simple and lack any real error checking. I do not advise using this for a production package. It should be used as a guide to create a template with scripts that adhere to each individual enterprises standards.   

Structure of the template:

Figure 1 shows the capture scripts that are part of the "Print_Driver_Capture_V1" template.

A PreLayerCapture script "Script 1" in Figure 1 called "RunPSInLayer.bat". This script will run prior to capture it stops the spooler, adds the Autorun entry needed to ensure the print spooler is running in the layer during the capture process, restarts the spooler and deactivates it prior to capture.

"RunPSInLayer.bat"

@Echo Off

set AS_PACKAGE_GUID=%2
Net Stop Spooler
svscmd %AS_PACKAGE_GUID% AUTORUN -A c:\Windows\System32\spoolsv.exe
Net Start Spooler
svscmd %AS_PACKAGE_GUID% D -F

 

A PostLayerCapture script "Script 2" in Figure 1 called "DelAutoPSInLayer.bat". This script will run after the capture process. It stops the spooler service, removes the Autorun entry that was only needed during the capture process and restarts the spooler. 

"DelAutoPSInLayer"

@Echo Off

set AS_PACKAGE_GUID=%2
Net Stop Spooler
svscmd %AS_PACKAGE_GUID% AUTORUN -D c:\Windows\System32\spoolsv.exe
Net Start spooler

Note: Both Scripts receive the %AS_PACKAGE_GUID% variable form the second parameter passed into the script from the 'param" field. 

param = $scriptresult$ $layerguid$

$layerguid$ is the second parameter therefore %2 will receive this value.

 

Figure 1

 

Figure 2 shows the execution scripts used to cycle the spooler when the layer is distributed.

Both Events OnPostActivate and OnPostDeactivate use the CycleSpooler.vbs file added as a data type. The script is added as data and the "Bundle with package" option set to true. this adds the script as "META" data so it is attached to the layer. 

Note: When testing you must compile the layer in the Symantec Virtual composer to add the script to the Meta Folder of the layer. If the spooler is not cycling check the meta folder to see if the Cycle spooler.vbs is present. If not you may not have compiled the layer yet.

This script simply stops and starts the spooler service. This is necessary during deployment for the printer to be visible on activation.

"CycleSpooler.vbs"

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colServiceList = objWMIService.ExecQuery _
    ("Select * from Win32_Service where Name='spooler'")

For Each objService In colServiceList
    objService.StopService()
Next
For Each objService In colServiceList
    errReturn = objService.StartService()
Next

Figure 2 

 Note: the execution events are not needed for the capture process. It was included in this template as an example of the usefulness of templates with execution events that could apply to multiple application layers such as cycling the spooler service for applications with printer drivers.

 

Importing the Template:

 Figure 3 shows how to import the template. Click the import template button in the upper right corner of the Template Editor's tool bar.  A Dialog box will appear, browse to the template you wish to add and it will be imported in your list "My Templates"

Figure 3                                                                     

             

Figure 4

Now the template is available for use when packaging.

Using the template to create a package:

Figure 5 shows how in the SVC capture wizard you will select the "Print_Driver_Capture_V1" template.

Once selected continue with the capture process of the application.

Figure 5

 

When the capture process is complete test by activating and deactivating the layer. When activated when opening devices and printers the printer associated to the application should be present. After deactivating opening Devices and printers again should show the printer is not present.

Comments 3 CommentsJump to latest comment

Pascal KOTTE's picture

Thanks

~Pascal @ Kotte.net~ Do you speak French? Et utilisez Altiris: venez nous rejoindre sur le GUASF

0
Login to vote
MattSpencer's picture

Thank you so much for the detailed walkthrough on how to use a template to virtualize an application with a printer driver, I was cracking my head over it and now it all makes more sense with this guide.

0
Login to vote
Nicolas Horchower's picture

Thanks for the template. It works great with software like PDF Creator. I've used it to capture Acrobat pro from CS4. I was initially following this article : http://www.symantec.com/connect/articles/readyvirt... Capture was fine, but when I tried to add a new reset point to merge the update with the package, SWV Admin hang (7 out of 9 stages 77%) (I'm using SWV 6.1 SP8 version 6.4.1711 x64 and OS is win 7 Ent x64). Any idea ?

--
NH

0
Login to vote