Posts

Showing posts from September, 2009

Programmatically Change Printer Settings

Image
Image via Wikipedia I recently had the need to provide printer admin access on an ERP server to ordinary users. Nothing makes me shudder more than elevating a users access on a machine that holds your entire business operation on it's drives... I was able to come up with a solution using CPAU.exe which I've written about here . The scenario: An active label printer and a backup. When one goes down, the other needs to be put into service, but it needs to have the same name as the active one did. The users then also need to be able to "flip a switch" to put the active one back into service. First, I needed the guts of the switching script, which makes use of Microsoft 's prncnfg.vbs script, stored on all Windows boxes in the %windir%\ system32 directory (Called ChangePrinter.cmd) : @ECHO OFF @SET _ONE=ACTIVEPROD @SET _ONE_DOWN=ACTIVEPROD_146 @SET _TWO=BACKUPPROD @SET _HOST=BAPFSVR03 :: PRINTERS RECEIVE ADDRESSES VIA DHCP :: WHEN NO ERROR CONDITIONS E