Printers need deleting

P

Peter Loerns

Hi, we are a using the below script which loads network printers in
one of our classrooms at our school. I want to add a line that deletes
all installed printers first before it installs the specified ones
below. This script was written for us by someone else and not being a
VB person, I am lost. Any help gratefully appreciated

Dim net
Set net = CreateObject("WScript.Network")
net.AddWindowsPrinterConnection "\\wpadmin\Colour_Laser"

Set net = CreateObject("WScript.Network")
net.AddWindowsPrinterConnection "\\wpadmin\ICT1_Laser"

Set net = CreateObject("WScript.Network")
net.SetDefaultPrinter "\\wpadmin\ICT1_Laser"
 
S

Sofia Engvall

In Microsofts Resourse Kit there's a tool called prnadmin.dll. There's also
a file prnadmin.doc with documentation.

Take a look at the clean.vbs example. You plobably don't even need to modify
it since it works with command line parameters. What it does is to remove
all printing components from a pc. Including ports and drivers.

If you wish I can send you my modified version that don't take command line
parameters... I could also send you a script just removing the printer
queues if that's what you want.

Good luck! :)

/Sofia
 
P

Peter Loerns

Is there not a line i can add at the beginning of the VB script that
deletes all installed printers first before deleting
 
Joined
Oct 27, 2006
Messages
1
Reaction score
0
Hi,
I am using a script to set a network printer through code:
A txtPrinter name is sent to the code file executing print. This txtPrinterNm comes through the profile of the user who is trying to print (a default printer is set in his user ID).
The problem is that the print is going to any one of the other printers that had been set by the user previously in his profile and the print does not come on the currently set printer. Is there any way to code something to refresh the cache/printer name(s) each time before a job is printed.
This problem becomes severe if more than one user are trying to print concurrently with different printers set in there profiles. The job is spooled and printed on any of the printers for all the users and not on their respectively set printers.

I also tried the following script but it did not work:
PrinterOptions.ReportPrinterOptions.PrinterName = txtPrinterNm
Set net = CreateObject("WScript.Network")
net.AddWindowsPrinterConnection(txtPrinterNm)
net.SetDefaultPrinter(txtPrinterNm)
 

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