Need to programmatically install a local printer.

  • Thread starter Thread starter Terry Olsen
  • Start date Start date
T

Terry Olsen

Can anyone give me some guidance on installing a local printer with VB 2005?
I'm guessing I would probably do this with WMI, but i'm not finding anything
obvious. I see how to add a networked printer, but nothing to add a local
printer, assign it a port & driver.
 
Is the driver already installed or do you need to silently run the driver
installation too?

I have used WMI to clear print queues,set default printer, enum printers,
installed network printers, but never to install one locally.

Don't see why you need a program to do it anyway if its a local printer
being as you will plug it all in... & will be standing in front of the
machine anyway

Don't see any point of your application

Unless its on a parallel port you won't need to select a port to use because
I guess it'll be a USB connection automatically be picked up by the OS

Maybe your best option is to look on the Microsoft Scripting website because
I am sure there's a VBS on ther for what you require

Here's a WMI Code Creator which lists the Printer classes & you can set it
to VB.NET. Maybe there is something in there:

http://www.microsoft.com/downloads/...64-ea15-4661-8da4-55bbc145c30e&DisplayLang=en

Here's your best bet: <------------------- Best bet

http://www.microsoft.com/technet/scriptcenter/scripts/default.mspx?mfr=true

Script Center Tools:

http://www.microsoft.com/technet/scriptcenter/createit.mspx

Script Center Homepage:

http://www.microsoft.com/technet/scriptcenter/default.mspx
 
There is a point...

A label printer is already installed. I need to edit the label printer
instance to print to a file. Then I need to install a temporary printer to
print to the label printer. This way I can use FileSystemWatcher to watch
for a printer file, edit it, and send it out to the printer.

My program needs to edit the existing printer and install the temporary
printer when it opens. It needs to remove the temporary printer and edit the
existing printer back to its original port when the program closes. This
allows the printing to resume normal operations when my program is not
running.
 
Back
Top