Jump to content

Login script to delete printers by wildcard?


Recommended Posts

Posted

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.


Posted

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

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