Script to remove all network printers

Reading Time: < 1 minute

Copy the below to a notepad file and rename something like RemoveNetworkPrinters.vbs (You may need to re-enter speech marks after copying.

The below script will prompt you to click OK before ap printer is removed.

To disable the promtt so all network printers are removed automatically, remove the line ‘WScript.Echo Printers.Item(i+1) from the script below.

‘—————————————————-

‘Remove all Network printers but not local printers

Set WshNetwork = WScript.CreateObject(“WScript.Network”)

Set Printers = WshNetwork.EnumPrinterConnections

For i = 0 to Printers.Count – 1 Step 2

    If Left(ucase(Printers.Item(i+1)),2) = “\\” Then

        ‘WScript.Echo Printers.Item(i+1)

        WSHNetwork.RemovePrinterConnection Printers.Item(i+1)

    End IF

Next

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.