From: Talib Al-Ali Talib on

Hello everyone,
I've been using the following command to programmatically add & install
LPT printers connected directly to WinXP computers. Everything goes ok with
that. However, when I try the same command to connect a USB printer, it
fails. Here is what I did.

rundll32 printui.dll,PrintUIEntry .... /r "LPT1:" ...
(The dots represents other paramteres that are non-relevant to my question)
Above command works OK !! with LPT printers.

Then, I assumed I would have to make below changes to make it work for USB
printers

rundll32 printui.dll,PrintUIEntry .... /r "USB001" ...

Still, the command gets processed successfully and the printer is added. BUT
!! I cannot print a test page, I get an error message that printing is failed
and the test page is visible at the printer queue. It will only work if I
manually change the port of that printer to another USB (2, 3, ...) from the
list of ports on printer properties. I don't know how to assign the right
port to a new printer using the command line.

I found no documentations on adding USB printers using the above command
(which is supposed to support USB ports).

I'd really really appreciate it if someone can help me out with this issue -
I've been invistigating on it for so long time.


Talib
From: Stefan Kuhr on
Hello Talib,

Talib Al-Ali wrote:
> <snip>
> I found no documentations on adding USB printers using the above command
> (which is supposed to support USB ports).
>
> I'd really really appreciate it if someone can help me out with this issue -
> I've been invistigating on it for so long time.
>

Download devcon.exe from MS and use it like so:

devcon install inffile hwid

inffile: Path to the inf file of the driver package
hwid: 1st hardware id or instance id (can't remember what) of the USB
printer

If you run this from a console window, note that you have to escape
ampersand characters - hwids very often contain ampersand characters.
Also make sure that the USB device is actually plugged into the USB port.

--
Stefan Kuhr

"Lesen schadet der Dummheit"
From: Talib Al-Ali on
Thanks Stefan,

I downloaded the tool and tried to use it but I had no clue on the HWID, do
you know where I can get it for a particular USB printer/device? is it unique
for each device or is it related to the USB port into which the device is
connected?

Thanks again for your response..


"Stefan Kuhr" wrote:

> Hello Talib,
>
> Talib Al-Ali wrote:
> > <snip>
> > I found no documentations on adding USB printers using the above command
> > (which is supposed to support USB ports).
> >
> > I'd really really appreciate it if someone can help me out with this issue -
> > I've been invistigating on it for so long time.
> >
>
> Download devcon.exe from MS and use it like so:
>
> devcon install inffile hwid
>
> inffile: Path to the inf file of the driver package
> hwid: 1st hardware id or instance id (can't remember what) of the USB
> printer
>
> If you run this from a console window, note that you have to escape
> ampersand characters - hwids very often contain ampersand characters.
> Also make sure that the USB device is actually plugged into the USB port.
>
> --
> Stefan Kuhr
>
> "Lesen schadet der Dummheit"
>
From: Stefan Kuhr on
Hello Talib,


Talib Al-Ali wrote:
> Thanks Stefan,
>
> I downloaded the tool and tried to use it but I had no clue on the HWID, do
> you know where I can get it for a particular USB printer/device? is it unique
> for each device or is it related to the USB port into which the device is
> connected?
>

IIRC, devcon has an option to enumerate all hardware ids.

--
Stefan Kuhr