Tip 52: Mixing the Old and New; Setting a Printer’s Print Processor Using PowerShell, WMI and Setprinter.exe

This tip has a little bit of everything thrown into the mix. Old Windows Resource Kit files, PowerShell, WMI and printers all in one; for the same low price of free!

I just helped one our hardware partners on an issue with printing. Turns out I don’t know as much as I thought about the subject before I met this individual, but they did ask me to help with some topics I am knowledgeable about, what are the chances of that?

The issue was that the Print Processor for all of the manufacturer’s printers installed on a machine needed to be changed but not any other printers, they needed to stay the same. If you don’t know what a print processor is or you would like very detailed information on how printing works see this; http://technet.microsoft.com/en-us/library/cc783789(v=WS.10).aspx. Basically, in the Windows 200/NT days Localspl.dll was the main DLL for local printing, including the print processor. Since Windows XP/2003 the print processor is a separate DLL called winprint.dll. Each printer manufacturer can create their own print processor and usually does.

There are a few ways to change the print processor for a printer. One is to go to the printer’s properties in Control Panel->Devices and Printers->Right Click->Printer Properties->Advanced tab->Print Processor….

On my Windows 8 machine I have 2 print processors, hpfpp70w and winprint. To change the processor for the printer, select the processor on the left and the default data type on the right. Most of the time you will not need to change your print processor, but if you are having printing issues you may want to. In most cases you will want to select a print processor from the same manufacturer of the printer. For my HP printer I would select the hpfpp70w processor, but to troubleshoot I may want to try the more generic winprint processor. Now imagine if you had 100 or 1,000 or 10,000 client machines with 1-10 printers installed on each to change. Using this way I would next expect to see you in a couple years.

The next way you can change the print processor and other printer properties is with a tool from the Windows 2003 Resource Kit called Setprinter.exe. This is nice as you can change the setting in 1 command like so.

Setprinter.exe <PRINTER NAME> 2 pPrinterProcessor=winprint

That certainly cuts down on the number of clicks to change the printer properties, but still would take a while to get the names of printers that needed changing and running the Setprinter.exe commands.

Since in this case all of the printers of the same manufacturer needed to be changed I needed a better way. Enter PowerShell. In PowerShell you can start a process/command using the Start-Process cmdlet. So why not put them both to use. Below is the script I created to set all printers with the manufacturer’s name in the printer name to the winprint print processor. The script will stop the spooler service using the built in Sc.exe command and then query WMI for all of the printers that contains the manufacturer’s name. It then cycles through them and sets the print processor using Setprinter.exe and finally starts the spooler service using Sc.exe again.

$args="stop Spooler"

start-process sc.exe $args

$colItems = Get-WmiObject Win32_Printer | ? {$_.Name -like "*Manufacturer*"}

foreach($objItem in $colItems) {

$args = """" + $objItem.Name + """" + " 2 " + "pPrintProcessor=winprint"

start-process setprinter.exe $args -wait}

$args="start Spooler"

start-process sc.exe $args

Of course you can change other printer properties. To view some of the information you can change you can run the following command that will output all of the level 2 properties for all of the printers on a machine. The double quotes means all printers.

SetPrinter.exe -show "" 2

Here is some sample output of my printers.

Sometimes you have to mix some of the old with the new to get the job done.

Those of you on Windows 8 or Windows Server 2012 can also use the new PowerShell printer cmdlets to manage printers. I could not find a lot of information on the new functions, but below is a list from PowerShell get-Help.

Comments (1)

  1. nick says:

    Thanks for this post, I was looking for something that might help out with setting a bunch of queues to Tray1 and Labels for the media type. This is what I ended up with for the Lexmark Universal (the 8 sets the Global or Printing defaults)

    "C:Program FilesWindows Resource KitsToolsSetPrinter.exe" QueueName_L1 8 "pdevmode=dmDefaultSource=1,dmMediaType=266"

    Thanks again

Skip to main content