Jump to content

Login script to delete printers by wildcard?


realized

Recommended Posts

Over the years we have had a few diffrent print servers/printers. I would like to "clean shop" and make sure everything is current on all clients without going pc to pc.

I am aware of the public scripts out there that let you delete a printer if you knwo the EXACT name of the printer.

But how about deleting a printer by wildcard?

I would like to delete anything that has *HP* or *Toshiba* in it, before i run the second part of the script which will install the CORRECT HP/TOSHIBA printer(s) and set the default printer.

Link to comment
Share on other sites


I don't think you can actually delete network printer connection using wildcards, but rather collect all printer names and then make a vbs script and remove them. Here is simple example how to remove network printer connection as well as printer icon.

Option Explicit
Dim objNetwork, strUNCPrinter
strUNCPrinter = "\\Server\Printer"

Set objNetwork = CreateObject("WScript.Network")
' Section which removes the network printer
objNetwork.RemovePrinterConnection strUNCPrinter

WScript.Echo "Check Printers folder NO: " & strUNCPrinter
Wscript.Quit

Logon Script ends here

Hope this helps

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...