How to remove multiple printers at once

B

Brock Bruner

I am trying to write a batch file to remove all network printer connections
to one print server and then add printers from a new server. I have started
to use the "rundll32 printui.dll, PrintUIEntry" command, but I cannot figure
out how to have it remove all the connections on the local machine the batch
file is run on. So instead, I am using con2prt, but I don't want to use
this command if I don't have to. Here is an example of my batch:

\\server\share\con2prt.exe /f

rundll32 printui.dll,PrintUIEntry /y /in /n\\server\printer1
rundll32 printui.dll,PrintUIEntry /in /n\\server\printer2
rundll32 printui.dll,PrintUIEntry /in /n\\server\printer3

I would prefer to use the rundll32 command for the entire file. Anyone able
to help on this?
 
J

Joe Wu [MSFT]

Hello Brock,

Thank you for your post.

I have performed some research. I found that we can also use "rundll32
printui.dll,PrintUIEntry" to delete the network printer connections. We can
use the following commands:

rundll32 printui.dll,PrintUIEntry /dn /c \\oldserver /n \\oldserver\printer1
rundll32 printui.dll,PrintUIEntry /dn /c \\oldserver /n \\oldserver\printer2
rundll32 printui.dll,PrintUIEntry /dn /c \\oldserver /n \\oldserver\printer3

I have tested the above commands and they worked well.

As an alternative, we can also use VB Script to delete network printers.
Here is a sample:

Set WshNetwork = WScript.CreateObject("WScript.Network")
PrinterPath = "\\oldserver\printer1"
WshNetwork.RemovePrinterConnection PrinterPath, true, true
PrinterPath = "\\oldserver\printer2"
WshNetwork.RemovePrinterConnection PrinterPath, true, true

However, please notice that we need to delete the existing printers one by
one. We cannot delete a batch of network printers by using one "rundll32
printui.dll,PrintUIEntry" command.

Personlly, I think that con2prt is an easier solution. Could you let me
know why you prefer "rundll32 printui.dll,PrintUIEntry" to con2prt? Is it
because you don't want to call additional utility on the network?

Thank you for using our news groups!

Regards,
Joe Wu
Product Support Services
Microsoft Corporation

Get Secure! - www.microsoft.com/security

====================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: "Brock Bruner" <[email protected]>
Subject: How to remove multiple printers at once
Date: Thu, 6 Nov 2003 14:04:27 -0700
Lines: 17
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <[email protected]>
Newsgroups: microsoft.public.win2000.printing
NNTP-Posting-Host: 198.202.202.1
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.win2000.printing:8665
X-Tomcat-NG: microsoft.public.win2000.printing

I am trying to write a batch file to remove all network printer connections
to one print server and then add printers from a new server. I have started
to use the "rundll32 printui.dll, PrintUIEntry" command, but I cannot figure
out how to have it remove all the connections on the local machine the batch
file is run on. So instead, I am using con2prt, but I don't want to use
this command if I don't have to. Here is an example of my batch:

\\server\share\con2prt.exe /f

rundll32 printui.dll,PrintUIEntry /y /in /n\\server\printer1
rundll32 printui.dll,PrintUIEntry /in /n\\server\printer2
rundll32 printui.dll,PrintUIEntry /in /n\\server\printer3

I would prefer to use the rundll32 command for the entire file. Anyone able
to help on this?
 
B

Brock Bruner

Our clients do not have the CON2PRT file installed. They would have to
access the file across the network. I would rather use the rundll32 command
as it runs locally.
 
J

Joe Wu [MSFT]

Hello Brock,

Thank you for your feedback. Yes, in this senario, we can use rundll32 or
VB script to remove the network printers, which do not need additional
tools.

Thank you for using our news group!

Regards,
Joe Wu
Product Support Services
Microsoft Corporation

Get Secure! - www.microsoft.com/security

====================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: "Brock Bruner" <[email protected]>
References: <[email protected]>
<[email protected]>
Subject: Re: How to remove multiple printers at once
Date: Thu, 13 Nov 2003 12:46:44 -0700
Lines: 98
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <Okj#[email protected]>
Newsgroups: microsoft.public.win2000.printing
NNTP-Posting-Host: 198.202.202.1
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.win2000.printing:8838
X-Tomcat-NG: microsoft.public.win2000.printing

Our clients do not have the CON2PRT file installed. They would have to
access the file across the network. I would rather use the rundll32 command
as it runs locally.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top