Script to remove TCP/IP Printers

HP Pavilion
November 19, 2007 at 15:54:52
Specs: Win XP MCE, 2.0GHz / 1 GB DDR

Hello,

I am looking to create a batch file to remove all TCP/IP printers, but keep all local printers. Currently I tried using windows prnmngr.vbs but it either deletes all printers including Adobe PDF writer or I can specify which printers to delete within the cmd. I basically need to click on a button and "bye bye" IP printers. Any help would be very much appreciated.

Thanks


See More: Script to remove TCP/IP Printers

Report •


#1
November 20, 2007 at 12:44:48

::==rmNetPrinters.bat
@echo off
wmic printer where "Local='FALSE'" delete
::==

I don't have Adobe PDF Writer on my machine so I don't know if this will delete that or not. I would assume not because it should be listed as a local printer, but again, I'm not sure.

"Computer security." — Oxymoron


Report •

#2
November 20, 2007 at 16:06:31

Thanks Tony... unfortunately TCP/IP printers are considered local printers not network printers. But I think I found a solution that works...

wmic printer where "PortName LIKE 'IP_%'" delete


Report •

#3
January 8, 2008 at 05:51:35

wmic printer where "PortName LIKE 'IP_%'" delete

The command above works well for me when executed locally, but fails when called via a URL? (I get "No Instance(s) Available.")

I'm trying to run this from a startup script in a machine GPO.

Any Suggestions would be greatly appreciated.

-MDH


Report •

Related Solutions

#4
January 8, 2008 at 13:42:50

I am using this command in a batch file called within a login script. If you are using it within a script you must put two %% as the command line will read one % as a special character. Two %% will read it as a single %. My command looks like this...

wmic printer where "PortName LIKE 'IP_%%'" delete

Hope that helps!


Report •

#5
January 9, 2008 at 05:49:59

That did it!

Thank you so much!

-MDH


Report •


Ask Question