Search The Web

Showing posts with label Printer. Show all posts
Showing posts with label Printer. Show all posts

Saturday, March 30, 2013

Remove Network Printers from Command Line or Script



Remove Network Printers from Command Line or Script


There are several options when it comes to removing printers via command line / script.The first option is to use the "rundll32 printui.dll" method. For this, open a command prompt and type:

rundll32 printui.dll,PrintUIEntry /dn /n \\printsvr\printername

if you want the operation to be silent, then use the /q switch at the end. this is especially useful if you have multiple printers that you want to remove via a batch file and/or if you are unsure if the printers are installed on the end users machines. If the printer is not currently installed and you attempt to remove it without the /q switch then you will receive an error. The figure below shows the command in its entirety:
Remove Network Printers from Command Line or Script
The next method would be to use a VB script such as this :
to make the script work, just replace the \\PRINTSERVER\PRINTERNAME" field with the details of your network printer and save as a .vbs file. to call the script just open up an administrator command prompt and type in " cscript scriptname.vbs " where scriptname is the name of your script.
To delete more printers just another line to the  " Dim sPrinterName "  lines with the printer number at the end, and then again  add another objNetwork.RemovePrinterConnection sPrinterName2, True, True line that reflects the printer number you just added.
Likewise, to remove only one printer just remove one of the above lines.


Option Explicit

  Dim objNetwork, objPrinters

  Set objNetwork = CreateObject("WScript.Network")
  Set objPrinters = objNetwork.EnumPrinterConnections

  ' ### Delete selected network printer

  Dim sPrinterName1
 Dim sPrinterName2
  sPrinterName1 = "\\PRINTSERVER\PRINTERNAME"
 sPrinterName2 = "\\PRINTSERVER\PRINTERNAME"
  objNetwork.RemovePrinterConnection sPrinterName1, True, True
 objNetwork.RemovePrinterConnection sPrinterName2, True, True

I found with this method however that it will error out if that printer does not exist. im not enough of a VB guru to tell you if its possible to quieten it down to run silently.

When all is said and done, there is a much better way of doing this, and that is with Group Policy Preferences. this gives you centralized control over your printer environments, allowing you to add and remove and update printers for small groups or your entire organisation.
Group Policy Preferences will be covered for printers in an upcoming entry.
This article can also be found on our You Tube Channel:















Tuesday, February 12, 2013

Adding Network Printers via DOS and Batch File


Adding Network Printers via DOS and Batch File


pretty easy this one.

if the network printer is shared, the command you need is:

start \\servername\printershare

this can be used in batch files as well.

note: if you use the unc path, dos will probably complain in a batch file that the UNC was used and not a mapped dive letter. If you are having troubles with this then just use a net use command to map the drive first.


Wednesday, November 9, 2011

Printer Error 0x000003eb when installing printer

Printer Error 0x000003eb when installing printer



When trying to connect to a network printer you get the following error 0x000003eb :
For me, this turned out to be a printer driver issue. To determine this, i created a new printer on the server using the same IP, driver, permissions etc and the problem again occurred.
I then changed the printer driver to a random driver  ( of a printer model that i know works OK on the server) on both the new and existing printer objects and ta-da the printer worked.
While researching this, i also found reference to the print spooler service crashing, however this was not a symptom in my case. IMHO, if the service is crashing when you install your printer, this probably points to a driver issue anyways

Tuesday, September 6, 2011

how do i add a network printer for all users?


use this for making printers install for all users instead of the current user in Windows 7

To install the printer for all users, follow these steps:
1. Click Start, click Control Panel and double click Devices and Printers.
2. Click Add a Printer.
3. Select "Add a local printer".
4. Select "Create a new port". Choose "Local Port" as the type of the port.

5. In the box "Enter a port name", type the address as the following format.
\\ [IP address of the host computer]\[The Share Name of the printer]
Then click Next.
6. Choose the correct driver in the driver list. If no available driver, click the button Windows Update, wait for the process finishes and then look for the driver again.
7. Shared this printer to all the users.
8. Finish the installation.