Archive for the ‘AutoIt’ Category

prnRename: an AutoIt based utility to rename IPP printers in Windows

Wednesday, October 17th, 2007

Using CUPS in conjunction with Windows is pretty easy to do, except there is one big major annoyance: you can’t rename the printer to something “friendly”, its always something long and annoying with the URL of the printer in it.

So, I jumped into the registry and figured out how to change it, and developed a tool using AutoIt (which works really well for these types of simple things) that allows you to change the URL and the name displayed for the printer in Windows Explorer.

See, at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers lies registry keys for all of the printers you have there, and you’ll notice that the key for the IPP printer starts with two ,, and the URL. So, you just need to rename that to whatever you want, then change the following keys/values under that key to the same thing (this is AutoIt code, but I think you get the point).

RegWrite($key,"Name","REG_SZ",$newPrinterName)
RegWrite($key & "\DsSpooler","printerName","REG_SZ",$newPrinterName)
RegWrite($key & "\DsSpooler","uNCName","REG_SZ", "\\" & @ComputerName & "\\\" & $newPrinterName)

After making the changes, restart the spooler service

net stop spooler
net start spooler

And, thats pretty much all there is to it. Obviously, use this at your own risk, seeing as this is modifying undocumented registry entries. Source code is included.

Download Windows 2000/XP IPP Printer Rename Utility