How To Delete Printers Via Batch Files
Batch files are often the easiest and most efficient solution for executing simple commands across a network of Windows-running computers. So while you may be tempted to dismiss them as a thing of the past, don’t be overly hasty. Many programmers still recommend and use them as a simple go-to solution for a number of tasks. One of these is removing a shared printer from a computer network.
Image Source: Juniorvelo
Here’s a quick guide to removing an old printer from every computer in your network:
First thing’s first, create a file using ASCII Text Editor, DOS Edit, or Windows Notepad, and save it as a .BAT file.
Now determine whether the printer is installed as a local printer or a network printer. For a local printer use the following code line:
RUNDLL32 printui.dll,PrintUIEntry /n \\server\printer.name /dl
But if it is a network printer, input the code as:
RUNDLL32 printui.dll,PrintUIEntry /n \\server\printer.name /dn
(Note: Obviously, you will need to swap out “printer.name” for the name of the printer you want to remove.)
If you are also installing a new printer, include a separate line of code for adding the new machine in the same batch file. If not, don’t worry about, skip to step 4.
Now run this new .BAT file on the admin computer, and when your users login, the code will run automatically and delete the unwanted printer.
One common obstacle that people sometimes encounter is an error message saying there is either a connection issue or that the printer name was entered incorrectly. If you get this error, try using the Local printer code instead of the Network printer code, or vice versa. Sometimes the printer has been installed counter-intuitively as one or the other.
Another issue that you might encounter is not knowing the name of the old printer. If this is the case, search for the file called “Share Name” in the following location:
HKLM\Software\Microsoft\Windows NT\CurrentVersion\Print\Providers\LanMan Print Services\Servers
It will give you the necessary printer name.
As you can see, it is a fairly straightforward process, and anyone with basic computer knowledge should be able to pull it off. In many cases, deleting an old printer like this is simply a way of cleaning up your network a bit, and will eliminate confusion and hassle for users who aren’t aware which printer is currently online. In any event, it is a good idea to familiarize yourself with the basics of batch files. They can come in quite handy.
This useful guide was contributed Oli Archibald from PrinterInks.com; an online shop specializing in ink cartridges from leading brands, such as Xerox, HP, Dell, Canon and Brother.If you would like to write for UniqueTipsOnline, check our guest posting guidelines.