Video Screencast Help

Virtualizing a Print Driver with SWV

Created: 09 Jul 2009 • Updated: 29 Jul 2010 | 4 comments
Language Translations
Jordan's picture
+10 10 Votes
Login to vote

Long time packagers know that the only way to capture a print driver, the most common being the Adobe Acrobat PDF Printer, in SVS is to use a Global Capture. At the same time they know that your Global Capture can cause problems with a layer (you never know what's going to be inside it.) So there's always been a catch-22 when dealing with this situation.

With SWV 6.1 there's a method for making sure that print drivers get into a layer by using single program capture, it takes a little extra work on the packager's end but in the long run it's much better than using the unpredictable Global Capture. And while, currently, I'm only aware of this method working for print drivers there are possibly other troublesome applications that can be captured as well.

To understand this new method for capturing you'll need to understand what is going on when a print driver is being installed and why SWV doesn't track this part of an install. When a print driver needs to be installed it's handled by the Window's service Print Spooler, spoolsv.exe in the process list, and this process\service is not getting launched by the installer but instead Windows itself. SWV cannot track it as a child process of the Adobe process-which is why a Global Capture has previously been required to get a print driver into a layer.

So if we've got a system process running that is being indirectly called by an installer, how do we virtualize it without a Global Capture? In SWV 6.1 we introduced a new feature called "Auto Run From Layer" which is a tab inside of the Layer Properties Window. When you add a process to this list any time that process is launched (by Windows or another application) it will run as if it was virtualized itself. In other words, all changes it makes will get captured into the layer. This behavior is more or less the same as Run From Layer (Execute from layer in SVScmd) which is a feature that's been in SVS for quite some time but not exposed via a GUI before SWV 6.1. You'll need to pass in the full path to the process because the feature doesn't use Path Variables. There are a lot of uses for this feature and this is the first that will explain how versatile it is.

When capturing a print driver we need to add its process, spoolsv.exe, to the Auto Run list so when the installer tells Windows that it has a new printer to install and the process is launched it will run as if it itself was virtualized. Then when the process is done you need to stop the Print Spooler service and immediately delete the Auto Run Process item because Auto Run From Layer will activate a layer if any process it's watching launches.

Before I get into detailed steps on how to capture Adobe Acrobat 9's print driver there's one more thing that needs to be brought up. If you open up Task Manager on a computer there's a good chance that spoolsv.exe is already running. In all my tests with Acrobat that process gets re-launched by the installer so our Auto Run item will execute. However, if that doesn't happen the process will not get tracked by SWV because Auto Run From Layer only works when a process is launched and not on processes that are already running?

So if you're noticing that your install isn't re-launching spoolsv.exe and your print driver isn't getting captured properly what can you do? Go old school with SVScmd's Exec from layer (Run from layer is SWVadmin) and a command file.

Here are the steps: (note this is not required for Acrobat 9)

  1. Open up Task Manager and get the PID for spoolsv.exe
  2. Create a new CMD file
  3. Inside it add following line: SVScmd myLayer exec -p myPid where my layer is the layer name or GUID and myPid is the PID you got from step 1.
  4. Next add a line that points to your installer (remember if it's a MSI to use Msiexec)
  5. Save the file
  6. Create a new layer in SWVadmin and point to the CMD file when browsing for a single program capture.

To Capture a Print Driver Using Auto Run From Layer

  1. Create a new layer is SWVadmin or SVScmd, it doesn't matter if you have anything else in the layer (if you want to combine an existing program with Acrobat Pro) but this guide will assume you're using an empty layer.
  2. Double click your layer to open up the Layer Properties window and navigate to the Autorun Applications tab.
  3. Right-click and select New AutoRun Entry.
  4. Add C:\WINDOWS\system32\spoolsv.exe to the text entry and close the Layer Properties window.

  5. With the window closed right-click your layer and select Add to Layer which will place our layer back into capture mode.

  6. In the window that opened up select Single Program Capture and point it to our Adobe Installer and click Next twice.

  7. Install Acrobat as normal. To end capture you may need to kill acrotray.exe and other related background processes to actually end capture. See this blog post for more information on how Capture has changed with SWV.
  8. Once capture is done you'll need to stop the Print Spooler before you'll be able to deactivate the layer, since spoolsv.exe is running a SYSTEM a force deactivate will not work. So open up the services manager, navigate down to Print Spooler and stop it.

  9. Deactivate your layer.
  10. Open back up the Layer Properties window and navigate to the AutoRun tab.
  11. Right-click and select Remove Autorun Entry

Once you've got the layer you'll need to either flag it to Start On System Startup or run a script that will restart the Printer Spool after a layer is activated so you can use the PDF printer, since the printer service has to be restarted to load new printers that were just installed.

Comments 4 CommentsJump to latest comment

trb48's picture

 That is much cleaner than using a global capture. I am excited to try it out once 6.1 is released.

I decided a few months back to put all of my printers into layers. It is really nice (especially when a printer is being replaced). It will be nice to know that when the new version comes out that my printer layres won't have the extra junk in them.

0
Login to vote
fireeyes's picture

i totally agree with you

0
Login to vote
Pascal KOTTE's picture

Hi & thanks.
For those who are using SVS 2.1, because lucky guys with CMS 7, but unlucky not owning the 45€/pc additionnal cost fro SWV 6.1, here the solution for SVS 2.1:

1st try - FAILED don't do that, or do better !

Just go to https://www-secure.symantec.com/connect/downloads/svs-multi-tool-v15
but you can create registry manually...
To be able to edit the OnPost commands for SVS 2.1 (as they are no AutoRun menu...)
I think it is required to use the "OnPreCapture", but as I was not absolutly sure, I add them in the 4 Pre commands, easy to remove. (I also remove the empty parameter addition "" muti-tool was adding)
onPOst Events.jpg

Just don't forgot to remove them after, I try it...
Oh, I must also add the serial of the upgrade to avoid user prompted for :-(
I will ad on the layer ;-) OK for the addition of the missing serial in just 2 minutes ;-)

But not working this WAY...  The "Start" spoolsv.exe can not be done this way... not fun ! :-(

I will try another way...

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

0
Login to vote
cdaguanno's picture

One ammendment to this procedure

To Capture a Print Driver Using Auto Run From Layer

  1. Create a new layer is SWVadmin or SVScmd, it doesn't matter if you have anything else in the layer (if you want to combine an existing program with Acrobat Pro) but this guide will assume you're using an empty layer.
  2. Double click your layer to open up the Layer Properties window and navigate to the Autorun Applications tab.
  3. Right-click and select New AutoRun Entry.
  4. Add C:\WINDOWS\system32\spoolsv.exe to the text entry and close the Layer Properties window.

  5. With the window closed right-click your layer and select Add to Layer which will place our layer back into capture mode.

After step 5 be sure to launch the spooler after you first start your instalation so that it is running in the layer. if it is not running in the layer before you continue with the install it may not capture the drivers

0
Login to vote