Friday, June 27, 2008

Changing the PrintProcessor on a Windows 2000 Print Server

One of our customers has a W2k print server with several hundred (nearly 600) printers. Half are used for a program named CreateForm and therefore have a printprocessor named CfPrint, but the rest have a mixture of WinPrint and some other HP processors. They recently began having printer problems that we couldn't diagnose, but the idea came up to limit the number of variables in play: drivers, configurations, processors, etc… So its up to me to make nearly 300 print queues use WinPrint as their processor.

Under W2k3 this would be an easy item, simply write a WMI script to query the printers and then set the processor to WinPrint. W2k however sets these properties as read-only, so back to the drawing board.

It looks possible to set the processor using printui.dll, but it requires a little knowledge to make it work. First off, it doesn't seem to set the processor when run locally, instead I had to set it remotely from a W2k3 system. Secondly, it has a complex command line that can be difficult to handle; I came up with the following:

rundll32 printui.dll,PrintUIEntry /Xs /n "\\server\printer" PrintProcessor WinPrint

Now that we have a command to set the processor, we need a list of printers to change. As I stated earlier, half of these are used in CreateForm and therefore cant be changed; so we need a list of all printers that are not using the CfPrint processor. The command line utility WMIC works well for this, by using the following command I can get a listing of all printers and their processors.

wmic /node:server path win32_printer get DeviceID, PrintProcessor

Pipe the output into Excel or some other tool to filter out anything you don't want to change and save the list of printers to a text file named printers.txt. Now to simply iterate through the file and execute the printui commands.

for /F %i in (printers.txt) do rundll32 printui.dll,PrintUIEntry /Xs /n "\\server\%i" PrintProcessor WinPrint

That's it! You can re-run the WMIC command to ensure you got everything. Of course if your doing as many printers as I am then it may take a few minutes for everything to settle properly

1 comment:

Hey said...

Is this command supported in Windows 2003?