We help IT Professionals succeed at work.

Removing printer with a login script

Medium Priority
Last Modified: 2012-05-05

I would like to know if it is possible to delete a local printer on Windows XP with a login script.

I know it is possible to delete a network printer with this VBscript

Dim net
Set net = CreateObject("WScript.Network")
net.RemovePrinterConnection "\\bonemine\020-labo-01"

But what about local printers???


Yan Bergeron
Watch Question


    net.RemovePrinterConnection ".\printername"

or maybe:

    net.RemovePrinterConnection "\\" & net.ComputerName & "\printername"




net.RemovePrinterConnection ".\HP 2000C"
      doesn't work. Error (this connection doesn't exist)

net.RemovePrinterConnection "\\" & net.ComputerName & "\HP 2000C"
      doesn't work. Error (this connection doesn't exist)

More idea?

Here is an example that uses Prnadmin.dll from the resource kit:


Not sure about this, but ......
When you use net.RemovePrinterConnection, don't worry about the machine name qualifier if its a local printer.
Try    net.RemovePrinterConnection "020-labo-01"

Alternatively :-)   The command below will install a printer instance.  I'm sure there's something similiar to remove one.

    Shell ("rundll32 printui.dll,PrintUIEntry /if /u /b " & Chr$(34) & FullPrinterDriverName & Chr$(34) & " /m " & Chr$(34) & FullPrinterDriverName & Chr$(34) & " /f " & Chr$(34) & PrinterDriverINF & Chr$(34) & " /r " & Chr$(34) & PrinterPort & Chr$(34))
delete them from registry with visual basic

HK current user / printers
search for the printer, and delete the key.

you can make an exe and put it in to the login script

also, maybe you are tired of xp automatic printer discovery, on explorer select TOOLS / OPTIONS
[ VIEW ]
[_] search for network printer / folders (something like that, i dont have an xp english version near)

hope this helps

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

thanks yanbergeron24

note that this procedure will left drivers and everything still on the disk.  wich can be cluttering if this is one of those printers that need special apps to make it work.


but if it is some "xp detected and automatically installed printer" i think there is no big trouble.

Thanks again.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.