Computing.Net > Forums > Programming > Script to remove TCP/IP Printers

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Script to remove TCP/IP Printers

Reply to Message Icon

Name: ToPo (by topo)
Date: November 19, 2007 at 15:54:52 Pacific
OS: Win XP MCE
CPU/Ram: 2.0GHz / 1 GB DDR
Product: HP Pavilion
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: tonysathre
Date: November 20, 2007 at 12:44:48 Pacific
Reply:

::==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


0

Response Number 2
Name: ToPo (by topo)
Date: November 20, 2007 at 16:06:31 Pacific
Reply:

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


0

Response Number 3
Name: mhouse
Date: January 8, 2008 at 05:51:35 Pacific
Reply:

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


0

Response Number 4
Name: ToPo (by topo)
Date: January 8, 2008 at 13:42:50 Pacific
Reply:

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!


0

Response Number 5
Name: mhouse
Date: January 9, 2008 at 05:49:59 Pacific
Reply:

That did it!

Thank you so much!

-MDH


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Script to remove TCP/IP Printers

Script to remove lines from a file www.computing.net/answers/programming/script-to-remove-lines-from-a-file/7090.html

windows script to remove LF and CR characters www.computing.net/answers/programming/windows-script-to-remove-lf-and-cr-characters/18903.html

IP Printer Script Not Working VBS www.computing.net/answers/programming/ip-printer-script-not-working-vbs/13139.html